Start free trial

Central data platform for your serverless environment.

Get full access to all premium features for 14 days. No code changes and no credit card required.

Password: 8+ characters, at least one upper case letter, one lower case letter, and one numeric digit

By signing up, you agree to our Privacy policy and
Terms and Conditions.

AWS Lambda: Task timed out after X seconds

When your error message says Task timed out after XX.00 seconds it means that AWS intentionally stopped the task once it hit a run-time of XX seconds.

Dashbird continuously monitors and analyses your serverless applications to ensure reliability, cost and performance optimisation and alignment with the Well Architected Framework.

Product Features Start Free Trial
Error Message: Task timed out after 6.01 seconds
Type: LOG EVENT
Severity: CRITICAL

When your error message says Task timed out after XX.00 seconds it means that AWS intentionally stopped the task once it hit a run-time of XX seconds.

Lambda functions are limited to a maximum execution time of 15 minutes (this was recently increased from the original 5 minutes timeout). The actual limit is configured when the Lambda function is created. The limit is in place because Lambda functions are meant to be small and quick rather than being large applications.

Diagnosing the root cause of timeouts:

It is important to understand what is eating up the execution time and causing the timeout. If you haven’t already, consider enabling AWS X-ray tracing. It will give you a breakdown of the execution and enable you to understand.

If you have reservations about X-ray, you can also consider logging out the main activities of the function to understand the timescale and identify bottlenecks inside a function execution.

When you have understood the underlying reasonds for a timeout, there are a couple of possible solutions:

Increase the timeout limit: the time limit is defined in function configuration and can easily be modified. The maximum limit set by AWS is currently 15 minutes.

Simplify the function: a well-written function usually only does one thing. If you’re executing multiple actions in a single function, it can be good to consider decoupling that function and breaking it up between multiple functions.

Don’t orchestrate/wait in code: if you’re waiting for a task to execute inside the function or using a function to coordinate between more than one additional task, there is a significant risk that you’ll end up accumulating additional costs and risking timing out. In addition, this is not aligned with the best practices of serverless. Consider orchestrating with step functions.

Made by Developers for Developers

Our history and present are deeply rooted in building large-scale cloud applications on state-of-the-art technology. Dashbird was born out of our own need for an enhanced serverless debugging and monitoring tool, and we take pride in being developers.