Python Lambda AWS Parameters and Secrets Lambda Extension timeout randomly

0

Hi, I have set up a Python 3.10 Lambda that has attached Secret Layer and NO VPC attached.

  • The timeout time is 20 seconds
  • The execution normally takes 1-3seconds
  • All Secret Layer variables aren't set, so the default

I have noticed that randomly (1 in ~10) the execution timeout. I have enabled the PARAMETERS_SECRETS_EXTENSION_LOG_LEVEL to DEBUG and checked in CloudWatch logs:

[AWS Parameters and Secrets Lambda Extension] 2023/05/24 14:35:16 INFO ready to serve traffic
[AWS Parameters and Secrets Lambda Extension] 2023/05/24 14:35:16 DEBUG Caching secret with key /secretsmanager
2023-05-24T14:35:36.156Z b6b0... Task timed out after 20.05 seconds

Normally after the DEBUG Caching secret with key /secretsmanager... line, the source code is executed and the function succeds. But in some cases the source code doesn't even start , so I can't write any logs inside because it doesn't get there

Any help is appreacited,

2 Answers
0

Assuming that you are using the AWS SDK, there are three reasons why retry and timeout issues occur when invoking a Lambda function with an AWS SDK:

A remote API is unreachable or takes too long to respond to an API call. The API call doesn't get a response within the socket timeout. The API call doesn't get a response within the Lambda function's timeout period.

For more information, please look at the following URL:

https://repost.aws/knowledge-center/lambda-function-retry-timeout-sdk

Please inform me if my answer was satisfactory by accepting my response with an up-vote.

AWS
ART
answered a year ago
  • I'm not using the AWS SDK

    I'm abstracting the call using the Lambda Layer

0

Please take a look at the following resolution:

https://repost.aws/knowledge-center/lambda-troubleshoot-invocation-timeouts

Please inform me if my answer was satisfactory by accepting my response with an up-vote.

AWS
ART
answered a year ago
  • I haven't been able to debug the error with any of the options there. Thanks anyways for the idea

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