INTEGRATION_TIMEOUT
- Default status
- 504
- What AWS says it is
- The gateway response for an integration timed out error
Why Amazon API Gateway returns a 504: the integration timeout limits for REST and HTTP APIs, how to confirm it in the logs, and how to fix a slow Lambda or backend.
A 504 from Amazon API Gateway means the backend integration did not answer within the integration timeout. For REST APIs the limit is 50 milliseconds to 29 seconds by default, and HTTP APIs top out at 30 seconds. Confirm the gateway response type in CloudWatch, then speed up the backend, raise the Lambda timeout only below the API limit, or make the work asynchronous.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
INTEGRATION_TIMEOUTINTEGRATION_FAILUREBoth types fall back to DEFAULT_5XX if you have not customized them. The same table lists REQUEST_TOO_LARGE (413), THROTTLED (429) and API_CONFIGURATION_ERROR (500), so check the type before you assume a timeout.
AWS adds a caveat for the raisable REST cases: you can raise the integration timeout above 29 seconds, but this "might require a reduction in your Region-level throttle quota for your account". The Lambda side has its own limit: the function timeout defaults to 3 seconds and can be set up to 900 seconds. A Lambda set to 60 seconds behind a 29 second API still returns a 504 to the client when the function runs longer than 29 seconds.
curl -s -o /dev/null -w "status=%{http_code} total=%{time_total}s\n" \
"https://abc123.execute-api.us-west-2.amazonaws.com/prod/report"REST API URLs have the form https://api-id.execute-api.region.amazonaws.com/stage/. Call the failing route with curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://api-id.execute-api.us-west-2.amazonaws.com/prod/getUsers. A 504 that arrives close to the integration timeout points to the timeout, not a crash.
For REST APIs, API Gateway has execution logging (errors and execution traces) and access logging. Enabling CloudWatch Logs needs the AmazonAPIGatewayPushToCloudWatchLogs managed policy on a role set as cloudWatchRoleArn on your account, once per Region.
The REST API metrics doc suggests watching IntegrationLatency for backend responsiveness and Latency for the whole call. Near-limit IntegrationLatency values confirm the backend is the slow part.
Time the Lambda or HTTP endpoint without the gateway. If it runs longer than the API limit, no gateway setting will fix it.
202 quickly and finish the job asynchronously; poll or notifyaws lambda update-function-configuration \
--function-name my-function \
--timeout 253 questions people ask next, answered from the sources on this page.
The default integration timeout for REST APIs is 50 milliseconds to 29 seconds for all integration types. When the Lambda function or HTTP backend does not respond within it, API Gateway returns an integration timeout response with status 504.
Not for edge-optimized REST APIs. For Regional and private REST APIs AWS says you can, but it might require reducing your Region-level throttle quota. HTTP APIs have a fixed 30 second maximum.
Both default to 504. AWS describes the first as an integration failed error and the second as an integration timed out error, so read the gateway response type in the logs to tell them apart.
Run the free audit, then approve the fixes. Every change can be undone.