Skip to content

Has anyone else encountered old/stale state? #47

Answered by KyleRoss
taschmidt asked this question in Q&A
Discussion options

You must be logged in to vote

You are correct, AWS does reuse the Node execution environment for subsequent executions to help alleviate the "warm-up" of spinning up a new execution environment. What you've described is a pretty common issue within Lambda that most developers do not account for; it's not what you would think any Node app to do, especially a Lambda function.

The solution for stale data is exactly as you described. I've written some lambda functions where I needed to move multiple requires inside of the handler function to ensure I create a new instance for each run. The same will need to happen for LambdaLog if you are providing execution-specific options, such as meta, to the constructor.

ESM:

import { 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by taschmidt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants