for some reason my AWS lambda returns a 502 error no matter how i change my response.
Sun Mar 25 03:39:12 UTC 2018 : Endpoint response body before transformations: {"status":200,"body":"{\"Items\":[],\"Count\":0,\"ScannedCount\":1}","isBase64Encoded":false,"headers":{"content-type":"application/json"}}
I have made sure to stringify my body and add the status, headers, and isBase64Encodeded properties. I have tried varying the headers and making them empty as well.
Why do i get this error?
here is the lambda code:
var response = {
status : 200,
body : JSON.stringify(data),
isBase64Encoded : false,
headers : {"content-type" : "application/json"}
}
console.log(response)
callback(null, response);
API Gateway expects statusCode, not status.
https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With