cloudtools / cloudtools/troposphere

ApiGateway CloudFormation template generated errors out with "The REST API doesn't contain any methods"

Open
#496 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I am just trying out the example file for ApiGateway and end up with the error "The REST API doesn't contain any methods" when running the created template. Everything seems to be fine with the template generated, or atleast i couldn't find anything wrong with it. Any one encounter the same issue? Here is a sample template generated for my snippet

```
{
"Parameters": {
"LambdaCodeHandler": {
"Default": "handler.handler",
"Type": "String"
},
"LambdaCodeRuntime": {
"Default": "python2.7",
"Type": "String"
},
"LambdaCodeS3Bucket": {
"Default": "someBucket",
"Type": "String"
},
"LambdaCodeS3Key": {
"Default": "someFile.zip",
"Type": "String"
},
"LambdaFunctionName": {
"Default": "utwrap-basic-lambda",
"Type": "String"
},
"LambdaMemorySize": {
"AllowedValues": [
128,
192,
256,
320,
384,
448,
512,
576,
640,
704,
768,
832,
896,
960,
1024,
1088,
1152,
1216,
1280,
1344,
1408,
1472,
1536
],
"Default": "128",
"Description": "Amount of memory to allocate to the Lambda Function",
"Type": "Number"
},
"LambdaTimeout": {
"Default": "60",
"Description": "Timeout in seconds for the Lambda function",
"Type": "Number"
}
},
"Resources": {
"utwrapBasicLambda": {
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "LambdaCodeS3Bucket"
},
"S3Key": {
"Ref": "LambdaCodeS3Key"
}
},
"Description": "test",
"FunctionName": {
"Ref": "LambdaFunctionName"
},
"Handler": {
"Ref": "LambdaCodeHandler"
},
"MemorySize": {
"Ref": "LambdaMemorySize"
},
"Role": {
"Fn::GetAtt": [
"utwrapBasicLambdaExecutionRole",
"Arn"
]
},
"Runtime": {
"Ref": "LambdaCodeRuntime"
},
"Timeout": {
"Ref": "LambdaTimeout"
}
},
"Type": "AWS::Lambda::Function"
},
"utwrapBasicLambdaExecutionRole": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
}
}
],
"Version": "2012-10-17"
},
"Path": "/",
"Policies": [
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"logs:*"
],
"Effect": "Allow",
"Resource": "arn:aws:logs:*:*:*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "root"
}
]
},
"Type": "AWS::IAM::Role"
},
"utwrapLambdaStatsApi": {
"Properties": {
"Name": "utwrapLambdaStatsApi"
},
"Type": "AWS::ApiGateway::RestApi"
},
"utwrapLambdaStatsMethod": {
"DependsOn": "utwrapBasicLambda",
"Properties": {
"AuthorizationType": "NONE",
"HttpMethod": "POST",
"Integration": {
"Credentials": {
"Fn::GetAtt": [
"utwrapBasicLambdaExecutionRole",
"Arn"
]
},
"IntegrationHttpMethod": "POST",
"IntegrationResponses": [
{
"StatusCode": "200"
}
],
"Type": "AWS",
"Uri": {
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
"us-east-1",
":lambda:path/2015-03-31/functions/",
{
"Fn::GetAtt": [
"utwrapBasicLambda",
"Arn"
]
},
"/invocations"
]
]
}
},
"MethodResponses": [
{
"StatusCode": "200"
}
],
"ResourceId": {
"Ref": "utwrapLambdaStatsResource"
},
"RestApiId": {
"Ref": "utwrapLambdaStatsApi"
}
},
"Type": "AWS::ApiGateway::Method"
},
"utwrapLambdaStatsResource": {
"Properties": {
"ParentId": {
"Fn::GetAtt": [
"utwrapLambdaStatsApi",
"RootResourceId"
]
},
"PathPart": "utwrapLambdaStats",
"RestApiId": {
"Ref": "utwrapLambdaStatsApi"
}
},
"Type": "AWS::ApiGateway::Resource"
},
"v1Deployment": {
"Properties": {
"RestApiId": {
"Ref": "utwrapLambdaStatsApi"
},
"StageName": "v1"
},
"Type": "AWS::ApiGateway::Deployment"
}
}
}

```

the template above fails with the following

> 2:29:12 UTC-0400 UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS AWS::CloudFormation::Stack utwrapLambdaTestStack2
> 22:28:55 UTC-0400 UPDATE_ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack utwrapLambdaTestStack2 The following resource(s) failed to create: [v1Deployment].
> 22:28:52 UTC-0400 CREATE_FAILED AWS::ApiGateway::Deployment v1Deployment The REST API doesn't contain any methods

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the generated template shown in the issue and inspect the relationship between the AWS::ApiGateway::Deployment, AWS::ApiGateway::Method, and AWS::ApiGateway::Resource entries. Determine why the deployment sees no methods; done means the generated CloudFormation stack creates the deployment successfully with its API method.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.