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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page