我通过API网关使用代理集成公开了多个Lambda。 时不时会出现状态代码502的奇怪错误。 Lambda Cloud Watch日志中没有任何内容。 下面是我发布的示例请求的API网关日志:
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Received response. Integration latency: 231 ms
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Endpoint response body before transformations:
{
"Message": "An error occurred and the request cannot be processed.",
"Type": "Service"
}
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Endpoint response headers:
{
Connection=keep-alive,
x-amzn-RequestId=0cbc9dee-f1bd-11e7-857b-91f7f814692c,
x-amzn-ErrorType=ServiceException,
Content-Length=86,
Date=Fri, 05 Jan 2018 02:06:32 GMT,
Content-Type=application/json
}
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Execution failed due to configuration error: Malformed Lambda proxy response
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Method completed with status: 502
基本上,似乎 API 网关无法访问 Lambda,并且对 Lambda 的调用返回:
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Endpoint response body before transformations:
{
"Message": "An error occurred and the request cannot be processed.",
"Type": "Service"
}
还有其他人遇到这些问题吗?我唯一可能的解决办法是编写重试机制,但从我的角度来看,似乎我缺少某些配置,或者这是AWS的故障,他们应该处理。