lambda function timeout does not work correctly

0

Hello

I increased the timeout for my lambda function from 3 seconds to 5 seconds through the UI. However, it seems that the timeout is still 3 seconds as the image file Enter image description here

I also check from CI command as: aws lambda get-function-configuration --function-name my-function

and got:

"Timeout": 5,

I is already some days after the change. Do I miss something

Many thanks

son
asked a month ago93 views
3 Answers
1
Accepted Answer

Do you see a timeout error in the Lambda log?

Could it be that you are using versions and aliases? If so, you probably changed the timeout on the latest version, but you are still invoking an older version.

profile pictureAWS
EXPERT
Uri
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Yep, we are using versions and alias. I pushed the code 2 days ago and saw that there was a request that had > 3seconds. So I think the timeout of 5 seconds is working. Just saw your reply and I think your answer is correct. Thanks

0

Hello.

What kind of processing does Lambda do?
For example, instead of Lambda timing out, is it possible that an API request running on Lambda is timing out?

profile picture
EXPERT
answered a month ago
0

1. Verify Deployment

Ensure that your Lambda function's new configuration (timeout) has been successfully deployed. After modifying the settings in the UI, you should confirm that the changes were saved and that there were no errors during the deployment process.

Try redeploying the function by making a small, non-impactful change and redeploying again.

2. Check for Other Timeouts

There may be additional layers (such as API Gateway or load balancer timeouts) impacting the function's execution. These could override or interfere with the Lambda timeout setting.

API Gateway Timeout: The maximum timeout for API Gateway is 29 seconds, but if it is set lower, it could cause your function to terminate early. ALB Timeout: If you're using an ALB, check the idle timeout settings.

3. Check Lambda Execution Logs (CloudWatch)

Inspect the function's logs in Amazon CloudWatch to see if any errors or timeout issues are being logged. The logs might reveal that the function is still hitting a timeout due to an unrelated issue (such as exceeding memory or processing capacity).

4. Test Locally via AWS CLI

Use the following CLI command to invoke the function with a payload and see if the timeout issue persists:

aws lambda invoke --function-name my-function --payload '{"key": "value"}' output.json

5. Verify CI/CD Configuration

If you are using a CI/CD pipeline to manage the Lambda function, ensure that the updated configuration (timeout change) has been pushed and applied through the pipeline.

Sometimes, CI/CD tools may override the configuration if the changes were only made through the console.

EXPERT
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions