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;
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
add a comment |
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
add a comment |
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
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
amazon-web-services aws-lambda amazon-cloudformation aws-api-gateway aws-sam
edited Mar 9 at 3:53
Pierre
asked Mar 9 at 3:48
PierrePierre
4,11422039
4,11422039
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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