Bootstrap FreeKB - Amazon Web Services (AWS) - Resolve Lambda Task Timed out
Amazon Web Services (AWS) - Resolve Lambda Task Timed out

Updated:   |  Amazon Web Services (AWS) articles

Let's say you are getting something like this when submitted a request to your Lambda Function.

2025-12-27T03:50:43.460Z d864fc69-9b31-4a3a-a7e3-55b417964805 Task timed out after 3.00 seconds

 

For example, if you are testing the Lambda Function in the AWS console, you may see something like this.

 

For example, perhaps you have a Python Lambda Function that does something and then returns a response.

import json

def lambda_handler(event, context):
    # code here for whatever the Lambda function is doing

    return {
        'statusCode': 200,
        'body': json.dumps({
            "response": response
        })
    }    

 

And let's say you have a Python script that invokes the Lambda Function.

#!/usr/bin/python
import boto3

client = boto3.client('lambda')
response = client.invoke(
        FunctionName="my-lambda-function"
        )

print(response)

 

The most likely reason "task timed out" is returned is because the task run time indeed exceeded the timeout with the Lambda Function.

The aws lambda list-functions command can be used to see the timeout of the Lambda Function. In this example, the Lambda Function will timeout after 3 seconds.

~]$ aws lambda list-functions --query 'Functions[?FunctionName==`myfunction`]'
[
    {
        "FunctionName": "myfunction",
        "Timeout": 3

 

Or in the AWS Lambda console.

 

The aws lambda update-function-configuration command can be used to increase the timeout.

aws lambda update-function-configuration --function-name myfunction --timeout 6

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 720d0d in the box below so that we can be sure you are a human.