AWS Certified Developer – Associate — Question 48

A developer is debugging an AWS Lambda function behind an Amazon API Gateway. Whenever the API Gateway endpoint is called, HTTP status code 200 is returned even though AWS Lambda is recording a 4xx error.
What change needs to be made to return a proper error code through the API Gateway?

Answer options

Correct answer: B

Explanation

The correct answer is B because using a Lambda proxy integration allows the Lambda function to return specific HTTP status codes and headers directly to the API Gateway, which can then relay the appropriate error codes to the client. The other options do not directly resolve the issue of returning accurate HTTP status codes from the Lambda function through the API Gateway.