AWS Lambda Task timed out after 6.00 seconds

darshi kothari picture darshi kothari · Dec 1, 2017 · Viewed 7.1k times · Source

I am using serverless framework. My Lambda function connects to DynamoDB table for updating item in table. Read & Write capacity units of table are 5 & auto_scaling is disabled. AWS Lambda function has 128MB memory allocated.

I have used Jmeter for performance testing.I have sent 1000 requests concurrently and some response giving me perfect output while other giving internal server error(502 Bad Gateway). i have also analyzed cloudwatch for logs and only get Task Timeout error. can anyone suggest me why i am getting this error and how to solve it?

Answer

Dunedan picture Dunedan · Dec 2, 2017

The default timeout for AWS Lambda functions when using the Serverless framework is 6 seconds. Simply change that to a higher value as noted in the documentation:

functions:
  hello:
    ...
    timeout: 10 # optional, in seconds, default is 6