Bird
0
0

Identify the error in this Lambda function triggered by API Gateway:

medium📝 Debug Q6 of 15
AWS - Serverless Architecture
Identify the error in this Lambda function triggered by API Gateway:
exports.handler = async (event) => {
  return { status: 200, body: 'Success' };
};
AMissing async keyword
BIncorrect response field 'status' instead of 'statusCode'
CBody should be JSON object, not string
DLambda handler name is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check response object fields for API Gateway

    API Gateway expects 'statusCode' field, not 'status'.
  2. Step 2: Confirm other parts are correct

    Async keyword and handler name are correct; body as string is allowed.
  3. Final Answer:

    Incorrect response field 'status' instead of 'statusCode' -> Option B
  4. Quick Check:

    Response field must be 'statusCode' [OK]
Quick Trick: Use 'statusCode' for HTTP status in Lambda response [OK]
Common Mistakes:
  • Using 'status' instead of 'statusCode'
  • Assuming body must be JSON object
  • Missing async keyword (not always required)

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes