- Newest
- Most votes
- Most comments
If you're using a non-proxy Lambda integration, you need to craft your payload using a model in the method request in API Gateway. You can see an example of how this works here [1]. If you're using a Lambda proxy integration type and you're getting a 502 error, this would often be a result of your function response being malformed and therefore API Gateway is unable to parse it. The response for a Lambda proxy integration must conform to the format that API Gateway is expecting in order for it to be successfully parsed. You can see the required format here [2]. If you're still having issues I'd recommend setting up execution logs for your API so that you can get more information on the cause of the failure.
Resources:
[1] Tutorial: Build an API Gateway REST API with Lambda non-proxy integration - Create an API with Lambda non-proxy integration - https://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-lambda-non-proxy-integration.html#getting-started-new-api [2] Set up Lambda proxy integrations in API Gateway - Output format of a Lambda function for proxy integration - https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format
Relevant content
- asked 9 months ago
- Accepted Answerasked 10 months ago
- AWS OFFICIALUpdated 14 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago