user2388553
user2388553

Reputation: 51

"Unable to parse HTTP response content" when creating ApiGateway::Resource

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

Answers (2)

Richard Friedman
Richard Friedman

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

300D7309EF17
300D7309EF17

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

Related Questions