我使用cloudformation建立了一个API网关资源,并且我注意到,如果您从控制台创建代理资源,那么方法响应字段不包含HTTP Status: Proxy
。
我的CF代码:
Api:
Type: AWS::ApiGateway::RestApi
Properties:
EndpointConfiguration:
Types:
- 'PRIVATE'
Name: 'why_did_aws_have_to_crash_today_APIG'
Resource:
Type: 'AWS::ApiGateway::Resource'
Properties:
ParentId: !GetAtt Api.RootResourceId
PathPart: '{proxy+}'
RestApiId: !Ref Api
Method:
Type: 'AWS::ApiGateway::Method'
Properties:
RestApiId: !Ref Api
ResourceId: !Ref Resource
HttpMethod: ANY
AuthorizationType: NONE
Integration:
IntegrationHttpMethod: ANY
Type: AWS_PROXY
Uri: arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:execute-api:us-east-1:why-did-aws-have-to-crash-today/invocations
发布于 2021-12-08 04:12:05
第一,应该是:
IntegrationHttpMethod: POST
来自文档
或者Lambda集成,您的必须对集成请求使用POST的HTTP方法,
其次,如果您想显式地添加MethodResponses
,那么应该是:
MethodResponses:
- ResponseModels: {"application/json": "Empty"}
StatusCode: 200
https://stackoverflow.com/questions/70269223
复制相似问题