Endpoint request timed out ☁️ AWS

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

  1. Move long tasks to async processing (SQS/Step Functions) and return 202
  2. Optimise the slow call; add timeouts on outbound requests
  3. Request a higher integration timeout where supported

Detailed fix by platform

AWS CLI

  1. aws logs tail /aws/lambda/my-fn --since 10m | grep -E 'REPORT|Task timed out'

How to diagnose

  1. Duration — Lambda REPORT duration
  2. Dependencies — Slow outbound calls?
  3. 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:

🧠 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.