AWS API Gateway Support
Fix API Gateway 504 Endpoint Request Timed Out.
API Gateway gives an integration a limited time to respond. When the backend takes longer, clients get a 504 even though the work may still be running. Raising a Lambda timeout does not help, because the gateway gives up first.
When You Need This
The situations where this work pays for itself.
Signs it is time
- Requests fail with 504 Endpoint request timed out
- Reports, exports or AI calls take longer than a few seconds
- The Lambda finishes, but the client already saw an error
- Slow database queries or partner APIs sit behind your API
- Timeouts started after traffic grew
What you get
- A root-cause analysis of the timeouts
- Code and configuration fixes
- An asynchronous request pattern where needed
- Dashboards and alarms for latency
How we do it
A clear, safe process you can follow along with.
1. Find where time is spent
We use X-Ray, access logs with integration latency and backend metrics to see whether the gateway, Lambda, VPC link or database is slow.
2. Fix the slow dependency
Missing indexes, cold starts, connection waits and slow third-party calls are repaired first.
3. Align timeouts
Backend timeouts must be shorter than the gateway integration timeout so errors are meaningful.
4. Make long work asynchronous
The API accepts the request, returns 202 with a job ID, and the work runs through SQS or Step Functions. Clients poll or receive a webhook.
5. Consider higher limits carefully
Regional REST APIs can have the integration timeout raised through a quota request, with trade-offs in throttling limits. We assess whether that is wise.
6. Add monitoring
We add latency and 5xx alarms with the integration latency metric.
Mistakes we help you avoid
Common ways this goes wrong, and what we do instead.
Increasing the Lambda timeout only
The gateway limit still applies. The client sees 504 regardless.
Retrying aggressively
Client retries multiply load on a struggling backend. We add backoff and idempotency.
Holding connections for long jobs
Long synchronous requests tie up resources. Asynchronous jobs scale better.
Frequently Asked Questions
What is the API Gateway timeout?
REST APIs default to a 29 second integration timeout, and HTTP APIs allow up to 30 seconds. REST limits can be raised for some API types by quota request.
How do I handle requests longer than 29 seconds?
Return immediately with a job ID and process asynchronously using SQS or Step Functions, then let clients poll or receive a callback.
Why do I get 504 but the Lambda succeeded?
The Lambda finished after API Gateway had already stopped waiting, so the client received the timeout.
Want Help With Fix API Gateway 504 Endpoint Request Timed Out?
Schedule an appointment. Tell us about your environment and we will outline the safest, highest-value approach.
Schedule Appointment › No commitment required