AWS Certified Developer – Associate (DVA-C02) — Question 415

A developer is building an application integrating an Amazon API Gateway with an AWS Lambda function. When calling the API, the developer receives the following error:

Wed Nov 08 01:13:00 UTC 2017 : Method completed with status: 502

What should the developer do to resolve the error?

Answer options

Correct answer: C

Explanation

An HTTP 502 (Bad Gateway) error in an Amazon API Gateway integration with AWS Lambda typically indicates that the Lambda function's output does not conform to the expected format required by the API Gateway proxy integration. To resolve this, the developer must ensure the Lambda function returns a properly structured JSON object containing keys such as 'statusCode', 'headers', and 'body'. Modifying the request payload, endpoint protocol, or authorization headers will not fix this response parsing issue.