当我尝试使用AWS CloudFormation创建与Lambda函数集成的API网关->GET
方法时,我得到了错误:CREATE_FAILED AWS::ApiGateway::Resource [my resource] Unable to parse HTTP response content
。
知道吗?!
在指定MethodResponses时,必须包含状态代码。
这将以"无法解析"失败:
"MethodResponses": [{
"ResponseModels": {
"application/json": { "Ref": "myModel" }
} } ],
这将取得成功:
"MethodResponses": [{
"ResponseModels": {
"application/json": { "Ref": "myModel" }
},
"StatusCode": 200
} ],
不,文件没有这样说。它也没有举例说明。
我曾经遇到过这个问题,并发现CloudFormation Designer中似乎有一个怪癖,它不断删除我的资源的parentId。
上传前请检查您的云形成模板,并确认ParentId仍在资源定义中。
"myApiResource": {
"Type": "AWS::ApiGateway::Resource",
"Properties": {
"RestApiId": {
"Ref": "myRestApi"
},
"PathPart": "mypath",
"ParentId": {
"Fn::GetAtt": [
"myRestApi",
"RootResourceId"
]
}
},