API Gateway: {"message": "Endpoint request timed out"} (504 after 29 seconds)
The backend (usually Lambda) didn’t respond within API Gateway’s integration timeout (29 seconds by default for REST APIs).
Seen on:
AWS
Meaning
Even if the Lambda timeout is 15 minutes, the API returns 504 at the integration limit. Long-running work must go async (queue + polling/webhook), or be sped up.
Common causes
- Lambda/backend work takes longer than the integration timeout
- Cold start + slow dependency (DB in VPC, external API)
- Lambda in a VPC without NAT waiting on internet calls
⚡ Quick fix
- Move long tasks to async processing (SQS/Step Functions) and return 202
- Optimise the slow call; add timeouts on outbound requests
- Request a higher integration timeout where supported
Detailed fix by platform
AWS CLI
aws logs tail /aws/lambda/my-fn --since 10m | grep -E 'REPORT|Task timed out'
How to diagnose
- Duration — Lambda REPORT duration
- Dependencies — Slow outbound calls?
- VPC — NAT for internet access?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in AWS
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026