Home › AWS Developer Associate › cloudcomputing › awsdevtroubleshooting › A Lambda function called from API Gateway return…
A Lambda function called from API Gateway returns 502 Bad Gateway under load. Logs show "Task timed out after 30.00 seconds." What is the FIRST thing to check?
AWhether AWS has globally rate-limited the customer's account
BWhether the function's downstream call (DB / external API) is slow — and whether the Lambda timeout (and/or memory) needs raising
CWhether the developer's laptop is online
DWhether the AWS root account is signed in
Answer & Solution
Correct answer: B. Whether the function's downstream call (DB / external API) is slow — and whether the Lambda timeout (and/or memory) needs raising
Task timed out = the function ran past its configured timeout — usually because a downstream call (DB, third-party HTTP, NAT) is slow. Raise timeout or fix the dependency. The other options are red herrings.
Related questions
A serverless app's Lambda functions are billed per-millisecond. Which cost-optimization stWhich CloudWatch construct sends an SNS notification when a Lambda's error rate exceeds 5%An application sends events to an SQS queue. Suddenly the queue's `ApproximateNumberOfMessA Lambda function in a VPC hits an external HTTPS API. Cold starts now take 8+ seconds insA team needs to query Lambda logs ad-hoc with SQL-like syntax (filter by request id, errorWhich CloudWatch feature lets a developer build a dashboard showing graphs of multiple metA Lambda function's 99th-percentile latency is dominated by cold starts. Which optimisatioA Lambda function intermittently exceeds its memory limit. The team has identified high me