AWS SAM: The REST API doesn't contain any methodsSAM Serverless implicit API vs AWS::Serverless::ApiAWS Serverless Application Model (SAM) — How do I change StageName?AWS Codepipeline ExampleHow can I change the name of the API stage in a SAM template?Is there a way to create dev/prod Amazon API Gateway/Lamda enviroments with push from dev to prod in one action?How to use API Gateway staging reliably?swagger file content is not updating in aws apigatewayHow to configure different APIGateway endpoints for lambda versions $LATEST and live AutoPublishAliasDeploy Lambda function in 2 Stages of Gateway via serverlessConnecting AWS Lambda Version/Alias with API Gateway Stage for API Versioning?x-amazon-apigateway-integration get lambda arn for uri property

I see my dog run

Where to refill my bottle in India?

Need help identifying/translating a plaque in Tangier, Morocco

Can you lasso down a wizard who is using the Levitate spell?

New order #4: World

Circuitry of TV splitters

Are white and non-white police officers equally likely to kill black suspects?

How do you conduct xenoanthropology after first contact?

What does "enim et" mean?

What is the white spray-pattern residue inside these Falcon Heavy nozzles?

how to create a data type and make it available in all Databases?

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Is Social Media Science Fiction?

How can I fix this gap between bookcases I made?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

How to avoid repetitive long generic constraints in Rust

Distance between two points on a map made for a game

Process builder are scheduled actions independent?

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

I am not able to install anything in ubuntu

Information to fellow intern about Hiring?

Set-theoretical foundations of Mathematics with only bounded quantifiers

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?



AWS SAM: The REST API doesn't contain any methods


SAM Serverless implicit API vs AWS::Serverless::ApiAWS Serverless Application Model (SAM) — How do I change StageName?AWS Codepipeline ExampleHow can I change the name of the API stage in a SAM template?Is there a way to create dev/prod Amazon API Gateway/Lamda enviroments with push from dev to prod in one action?How to use API Gateway staging reliably?swagger file content is not updating in aws apigatewayHow to configure different APIGateway endpoints for lambda versions $LATEST and live AutoPublishAliasDeploy Lambda function in 2 Stages of Gateway via serverlessConnecting AWS Lambda Version/Alias with API Gateway Stage for API Versioning?x-amazon-apigateway-integration get lambda arn for uri property






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to use AWS SAM to deploy a simple API.
When the API is simple (that is, does not specify explicitly an API Gateway). the deployment succeeds.



However, the following deployment fails:



AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Sample API

Parameters:
Stage:
Type: String
AllowedValues:
- dev
- sat
- demo
- staging
- prod
Description: Enter dev, sat, demo, staging or prod

Resources:

MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: !Ref Stage
EndpointConfiguration: PRIVATE
DefinitionBody:
swagger: '2.0'
x-amazon-apigateway-policy:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: "*"
Action: execute-api:Invoke
Resource:
- !Sub arn:aws:execute-api:*:*:*/$Stage/*

ThumbnailFunction:
Type: 'AWS::Serverless::Function'
Properties:
Runtime: nodejs8.10
Handler: get-config.handler
CodeUri: ./functions
Events:
ThumbnailApi:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /thumbnail
Method: GET


The error message is the following:



The REST API doesn't contain any methods (Service: AmazonApiGateway;
Status Code: 400; Error Code: BadRequestException


Looking on Google, I do find mentions of this error when manually specifying a deployment (here, or here). In my case, the deployment is implicit, hence I assume my issue is different.



The code I'm using is based on a SAM example (here). I'm scratching my head to understand what is wrong with my stack.



Any pointers to a solution?










share|improve this question






























    0















    I'm trying to use AWS SAM to deploy a simple API.
    When the API is simple (that is, does not specify explicitly an API Gateway). the deployment succeeds.



    However, the following deployment fails:



    AWSTemplateFormatVersion: '2010-09-09'
    Transform: AWS::Serverless-2016-10-31
    Description: Sample API

    Parameters:
    Stage:
    Type: String
    AllowedValues:
    - dev
    - sat
    - demo
    - staging
    - prod
    Description: Enter dev, sat, demo, staging or prod

    Resources:

    MyApi:
    Type: AWS::Serverless::Api
    Properties:
    StageName: !Ref Stage
    EndpointConfiguration: PRIVATE
    DefinitionBody:
    swagger: '2.0'
    x-amazon-apigateway-policy:
    Version: '2012-10-17'
    Statement:
    - Effect: Allow
    Principal: "*"
    Action: execute-api:Invoke
    Resource:
    - !Sub arn:aws:execute-api:*:*:*/$Stage/*

    ThumbnailFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
    Runtime: nodejs8.10
    Handler: get-config.handler
    CodeUri: ./functions
    Events:
    ThumbnailApi:
    Type: Api
    Properties:
    RestApiId: !Ref MyApi
    Path: /thumbnail
    Method: GET


    The error message is the following:



    The REST API doesn't contain any methods (Service: AmazonApiGateway;
    Status Code: 400; Error Code: BadRequestException


    Looking on Google, I do find mentions of this error when manually specifying a deployment (here, or here). In my case, the deployment is implicit, hence I assume my issue is different.



    The code I'm using is based on a SAM example (here). I'm scratching my head to understand what is wrong with my stack.



    Any pointers to a solution?










    share|improve this question


























      0












      0








      0








      I'm trying to use AWS SAM to deploy a simple API.
      When the API is simple (that is, does not specify explicitly an API Gateway). the deployment succeeds.



      However, the following deployment fails:



      AWSTemplateFormatVersion: '2010-09-09'
      Transform: AWS::Serverless-2016-10-31
      Description: Sample API

      Parameters:
      Stage:
      Type: String
      AllowedValues:
      - dev
      - sat
      - demo
      - staging
      - prod
      Description: Enter dev, sat, demo, staging or prod

      Resources:

      MyApi:
      Type: AWS::Serverless::Api
      Properties:
      StageName: !Ref Stage
      EndpointConfiguration: PRIVATE
      DefinitionBody:
      swagger: '2.0'
      x-amazon-apigateway-policy:
      Version: '2012-10-17'
      Statement:
      - Effect: Allow
      Principal: "*"
      Action: execute-api:Invoke
      Resource:
      - !Sub arn:aws:execute-api:*:*:*/$Stage/*

      ThumbnailFunction:
      Type: 'AWS::Serverless::Function'
      Properties:
      Runtime: nodejs8.10
      Handler: get-config.handler
      CodeUri: ./functions
      Events:
      ThumbnailApi:
      Type: Api
      Properties:
      RestApiId: !Ref MyApi
      Path: /thumbnail
      Method: GET


      The error message is the following:



      The REST API doesn't contain any methods (Service: AmazonApiGateway;
      Status Code: 400; Error Code: BadRequestException


      Looking on Google, I do find mentions of this error when manually specifying a deployment (here, or here). In my case, the deployment is implicit, hence I assume my issue is different.



      The code I'm using is based on a SAM example (here). I'm scratching my head to understand what is wrong with my stack.



      Any pointers to a solution?










      share|improve this question
















      I'm trying to use AWS SAM to deploy a simple API.
      When the API is simple (that is, does not specify explicitly an API Gateway). the deployment succeeds.



      However, the following deployment fails:



      AWSTemplateFormatVersion: '2010-09-09'
      Transform: AWS::Serverless-2016-10-31
      Description: Sample API

      Parameters:
      Stage:
      Type: String
      AllowedValues:
      - dev
      - sat
      - demo
      - staging
      - prod
      Description: Enter dev, sat, demo, staging or prod

      Resources:

      MyApi:
      Type: AWS::Serverless::Api
      Properties:
      StageName: !Ref Stage
      EndpointConfiguration: PRIVATE
      DefinitionBody:
      swagger: '2.0'
      x-amazon-apigateway-policy:
      Version: '2012-10-17'
      Statement:
      - Effect: Allow
      Principal: "*"
      Action: execute-api:Invoke
      Resource:
      - !Sub arn:aws:execute-api:*:*:*/$Stage/*

      ThumbnailFunction:
      Type: 'AWS::Serverless::Function'
      Properties:
      Runtime: nodejs8.10
      Handler: get-config.handler
      CodeUri: ./functions
      Events:
      ThumbnailApi:
      Type: Api
      Properties:
      RestApiId: !Ref MyApi
      Path: /thumbnail
      Method: GET


      The error message is the following:



      The REST API doesn't contain any methods (Service: AmazonApiGateway;
      Status Code: 400; Error Code: BadRequestException


      Looking on Google, I do find mentions of this error when manually specifying a deployment (here, or here). In my case, the deployment is implicit, hence I assume my issue is different.



      The code I'm using is based on a SAM example (here). I'm scratching my head to understand what is wrong with my stack.



      Any pointers to a solution?







      amazon-web-services aws-lambda amazon-cloudformation aws-api-gateway aws-sam






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 at 3:53







      Pierre

















      asked Mar 9 at 3:48









      PierrePierre

      4,11422039




      4,11422039






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Just as the error message says, you have not defined any methods in your Swagger. I think your confusion is here:




          In my case, the deployment is implicit, hence I assume my issue is different.




          SAM does create implicit APIs of type AWS::Serverless::Api from the union of Api events defined on AWS::Serverless::Function resources - but only if they do not refer (via the RestApiId property) to an AWS::Serverless::Api resource that you defined explicitly in the template. And in your case, it does.



          Also, you mention that your template is based on the "api_swagger_cors" example SAM template here, but in fact there is a key difference between yours and that example, namely: in the example, a Swagger YAML file is being pulled in from an S3 bucket; whereas in yours, your Swagger is defined inline, but it doesn't define any methods.



          For more info:



          • See this answer on implicit v explicit APIs (I also wrote that).

          • See this page for the structure of a Swagger.





          share|improve this answer


















          • 2





            Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

            – Pierre
            Mar 9 at 14:01











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073791%2faws-sam-the-rest-api-doesnt-contain-any-methods%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Just as the error message says, you have not defined any methods in your Swagger. I think your confusion is here:




          In my case, the deployment is implicit, hence I assume my issue is different.




          SAM does create implicit APIs of type AWS::Serverless::Api from the union of Api events defined on AWS::Serverless::Function resources - but only if they do not refer (via the RestApiId property) to an AWS::Serverless::Api resource that you defined explicitly in the template. And in your case, it does.



          Also, you mention that your template is based on the "api_swagger_cors" example SAM template here, but in fact there is a key difference between yours and that example, namely: in the example, a Swagger YAML file is being pulled in from an S3 bucket; whereas in yours, your Swagger is defined inline, but it doesn't define any methods.



          For more info:



          • See this answer on implicit v explicit APIs (I also wrote that).

          • See this page for the structure of a Swagger.





          share|improve this answer


















          • 2





            Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

            – Pierre
            Mar 9 at 14:01















          0














          Just as the error message says, you have not defined any methods in your Swagger. I think your confusion is here:




          In my case, the deployment is implicit, hence I assume my issue is different.




          SAM does create implicit APIs of type AWS::Serverless::Api from the union of Api events defined on AWS::Serverless::Function resources - but only if they do not refer (via the RestApiId property) to an AWS::Serverless::Api resource that you defined explicitly in the template. And in your case, it does.



          Also, you mention that your template is based on the "api_swagger_cors" example SAM template here, but in fact there is a key difference between yours and that example, namely: in the example, a Swagger YAML file is being pulled in from an S3 bucket; whereas in yours, your Swagger is defined inline, but it doesn't define any methods.



          For more info:



          • See this answer on implicit v explicit APIs (I also wrote that).

          • See this page for the structure of a Swagger.





          share|improve this answer


















          • 2





            Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

            – Pierre
            Mar 9 at 14:01













          0












          0








          0







          Just as the error message says, you have not defined any methods in your Swagger. I think your confusion is here:




          In my case, the deployment is implicit, hence I assume my issue is different.




          SAM does create implicit APIs of type AWS::Serverless::Api from the union of Api events defined on AWS::Serverless::Function resources - but only if they do not refer (via the RestApiId property) to an AWS::Serverless::Api resource that you defined explicitly in the template. And in your case, it does.



          Also, you mention that your template is based on the "api_swagger_cors" example SAM template here, but in fact there is a key difference between yours and that example, namely: in the example, a Swagger YAML file is being pulled in from an S3 bucket; whereas in yours, your Swagger is defined inline, but it doesn't define any methods.



          For more info:



          • See this answer on implicit v explicit APIs (I also wrote that).

          • See this page for the structure of a Swagger.





          share|improve this answer













          Just as the error message says, you have not defined any methods in your Swagger. I think your confusion is here:




          In my case, the deployment is implicit, hence I assume my issue is different.




          SAM does create implicit APIs of type AWS::Serverless::Api from the union of Api events defined on AWS::Serverless::Function resources - but only if they do not refer (via the RestApiId property) to an AWS::Serverless::Api resource that you defined explicitly in the template. And in your case, it does.



          Also, you mention that your template is based on the "api_swagger_cors" example SAM template here, but in fact there is a key difference between yours and that example, namely: in the example, a Swagger YAML file is being pulled in from an S3 bucket; whereas in yours, your Swagger is defined inline, but it doesn't define any methods.



          For more info:



          • See this answer on implicit v explicit APIs (I also wrote that).

          • See this page for the structure of a Swagger.






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 9 at 9:18









          Alex HarveyAlex Harvey

          5,83111229




          5,83111229







          • 2





            Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

            – Pierre
            Mar 9 at 14:01












          • 2





            Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

            – Pierre
            Mar 9 at 14:01







          2




          2





          Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

          – Pierre
          Mar 9 at 14:01





          Thank you ; it is disappointing that Swagger seems to be the only way to define gateway policy in SAM, and at the same time that it requires basically defining function events twice.

          – Pierre
          Mar 9 at 14:01



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073791%2faws-sam-the-rest-api-doesnt-contain-any-methods%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme