I have multiple lambdas exposed with api gateway using proxy integration. From time to time i'm getting strange errors with status code 502. There is nothing in lambda cloud watch logs. Below i posted api gateway logs for sample request:
(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
Basically it seems that api gateway cannot reach lambda and call to lambda is returning:
(0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Endpoint response body before transformations:
{
"Message": "An error occurred and the request cannot be processed.",
"Type": "Service"
}
Is there any one else experiencing those issues? Only possible fix from my side is to write retry mechanism but from my side it looks rather that i am missing some configuration or it's AWS failure which they should handle.