Default
- Value
- 3 seconds
Fix an AWS Lambda timeout: the 3 second default, the 900 second limit, console and CLI steps to raise it, memory and init fixes, retries and load balancer 502s.
A Lambda timeout means your function ran longer than its configured timeout and Lambda stopped it. AWS's troubleshooting guide shows the error as "Task timed out after 3.00 seconds". The timeout defaults to 3 seconds and can be set from 1 to 900 seconds (15 minutes). Raise it, add memory, trim init code, and make any caller wait longer than the function.
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.
Task timed out after 3.00 secondsCommon causes AWS lists: downloads from Amazon S3 that are larger or slower than average, a call to another service that takes longer to respond, and parameters that need more computation. AWS also notes that a timeout close to your average duration risks unexpected timeouts, and that tests should use realistic data sizes, not small samples.
aws lambda update-function-configuration \
--function-name my-function \
--timeout 120Resources:
my-function:
Type: AWS::Serverless::Function
Properties:
CodeUri: .
MemorySize: 128
Timeout: 120In the Lambda console, open the function, choose Configuration > General configuration > Edit, set Timeout between 1 and 900 seconds, and Save.
AWS says more memory also means proportionally more CPU, which can speed up both the Init and Invoke phases.
If the log shows Sandbox.Timedout, the Init phase timed out. AWS says Lambda then re-runs Init on the next invoke (a suppressed init), which with a short timeout of around 3 seconds may not finish. Reduce the init code, or raise the timeout.
Time the S3 download or downstream call with logs to see which step takes the time.
By default, when an asynchronous invocation returns an error, Lambda tries two more times, with a one-minute wait between the first two attempts and two minutes between the second and third. AWS counts runtime errors such as timeouts as function errors. For throttling (429) and 500-series errors, Lambda requeues the event for up to 6 hours by default. Configure a dead-letter queue or an on-failure destination to capture failed events, and make the function safe to run twice on the same event.
A synchronous caller has its own limit. For an Application Load Balancer with a Lambda target, AWS lists a 502 when the function did not respond before its configured timeout, or returned an error or was throttled, and a 504 when the Lambda service did not respond before the connection timeout. Keep the function timeout shorter than the caller's, and see AWS 502 Bad Gateway, 502 Bad Gateway and 504 Gateway Timeout. For the SEO side of 5xx responses, see 5xx server errors.
Related errors: API Gateway 504, Netlify function timeouts, Vercel function timeouts.
4 questions people ask next, answered from the sources on this page.
Open the function in the console, go to Configuration > General configuration > Edit, set Timeout up to 900 seconds and save. Or run aws lambda update-function-configuration --function-name my-function --timeout 120.
Up to 900 seconds (15 minutes) in a single invocation. AWS gives 5,400 seconds (90 minutes) for Lambda Managed Instances with asynchronous or event source mapping invocations, except Amazon MQ and Amazon DocumentDB.
For asynchronous invocations that return an error, such as a timeout, Lambda runs the function two more times, waiting one minute and then two minutes. Throttling and system errors are retried for up to 6 hours by default.
3 seconds.
Run the free audit, then approve the fixes. Every change can be undone.