Courseiva
Question 79 of 724
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

An API Gateway REST API invokes Lambda synchronously. Clients receive 502 responses after a deployment, but Lambda logs show a successful business operation. What is the most likely issue?

⚠ Common exam trap

The trap here is that candidates see 'successful business operation' in logs and assume the Lambda is fine, overlooking that API Gateway proxy integration enforces a strict response contract, not just any valid return value.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The Lambda proxy integration response format is invalid

Lambda proxy integration requires the response to be in a specific JSON format: `{"statusCode": ..., "headers": ..., "body": ...}`. If the Lambda function returns a plain string or an object missing these keys, API Gateway cannot map it to an HTTP response, resulting in a 502 Internal Server Error. The successful business operation in logs confirms the Lambda code ran correctly, but the malformed response format causes the gateway error.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The Lambda execution role lacks dynamodb:PutItem

    Why it's wrong here

    If the Lambda execution role lacks `dynamodb:PutItem`, the Lambda function would fail when attempting to interact with DynamoDB, resulting in an internal server error within Lambda. While this failure would cause API Gateway to return a 500 status code to the client, it specifically indicates an issue with the Lambda function's *execution permissions*, not a problem with the *format* of the response API Gateway expects from Lambda for proxy integration. The question implies a problem with how API Gateway processes the *response*, not necessarily the Lambda's internal operational failure.

  • The Lambda proxy integration response format is invalid

    Why this is correct

    In a Lambda proxy integration, API Gateway expects the Lambda function's response to adhere to a specific JSON structure, including `statusCode`, `headers`, and a `body` field (which must be a string). If the Lambda function returns a response that deviates from this required format—for example, missing the `statusCode` or `body` fields, or if the `body` is not a string—API Gateway cannot properly parse it. Consequently, API Gateway will fail to construct a valid HTTP response for the client and will return a 500 Internal Server Error.

  • The API cache TTL is too short

    Why it's wrong here

    A short API cache TTL (Time To Live) primarily affects the performance and cost efficiency of the API Gateway. A shorter TTL means cached responses expire more quickly, leading to more frequent invocations of the backend Lambda function. While this might increase latency for subsequent requests or incur higher Lambda costs, it does not inherently cause API Gateway to return a 500 Internal Server Error to clients. The API Gateway would still correctly process and forward responses, just with less caching benefit.

  • The API stage has X-Ray tracing enabled

    Why it's wrong here

    Enabling X-Ray tracing on an API Gateway stage is a diagnostic and monitoring feature designed to help developers analyze and debug requests as they flow through their services. While tracing adds a minimal amount of overhead to request processing, it is specifically built to be non-intrusive. It provides visibility into the request lifecycle and performance, but it does not cause the API Gateway itself to fail or return a 500 Internal Server Error due to an invalid response format or operational issue.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.