Amazon Web Services · api · fg-0171

API Gateway returns 504 Endpoint request timed out after about 29 seconds while the Lambda keeps running

If you see {"message": "Endpoint request timed out"} with HTTP 504, the cause and the fix for Amazon Web Services are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
{"message": "Endpoint request timed out"} with HTTP 504Lambda logs show the function finishing successfully after 30 or more secondsRaising the Lambda timeout to 15 minutes changes nothing
Cause
REST APIs cap integration time at 29 seconds by default and HTTP APIs at 30 seconds, independent of the Lambda timeout. Only Regional and private REST APIs can raise it, through a quota request that may lower the account throttle.
Fix
Move long work to an async pattern (return 202 and poll, or use a queue), or for a Regional or private REST API request a higher integration timeout quota. Edge-optimized REST APIs and HTTP APIs cannot go higher.
Apply
# Service Quotas, API Gateway: 'Maximum integration timeout in milliseconds' (L-E5AE38E3) aws service-quotas request-service-quota-increase \ --service-code apigateway --quota-code L-E5AE38E3 --desired-value 120000
Affected
API Gateway REST APIs (29 s default; raisable for Regional and private REST APIs since 2024-06-04) and HTTP APIs (30 s hard limit)
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun