Reputation: 51
When I tried to create API Gateway-> GET
method with integration to Lambda function using AWS CloudFormation, I'm getting error:
CREATE_FAILED AWS::ApiGateway::Resource [my resource] Unable to parse HTTP response content
.
Any idea ?!
Upvotes: 5
Views: 2729
Reputation: 942
I had faced the issue and found that in the end there seems to be a quirk in the CloudFormation Designer which keeps removing the parentId for my resource.
Check your cloud formation template before uploading and confirm the ParentId is still in the resource definition.
"myApiResource": {
"Type": "AWS::ApiGateway::Resource",
"Properties": {
"RestApiId": {
"Ref": "myRestApi"
},
"PathPart": "mypath",
"ParentId": {
"Fn::GetAtt": [
"myRestApi",
"RootResourceId"
]
}
},
Upvotes: 0
Reputation: 24613
When specifying the MethodResponses, it's mandatory to include the status code.
This will fail with "unable to parse":
"MethodResponses": [{
"ResponseModels": {
"application/json": { "Ref": "myModel" }
} } ],
And this will succeed:
"MethodResponses": [{
"ResponseModels": {
"application/json": { "Ref": "myModel" }
},
"StatusCode": 200
} ],
No, the documentation doesn't say this. Nor does it give an example.
Upvotes: 1