Closed tim-white87 closed 4 years ago
Not sure if this is a bug, or a feature request, but global variables are reset when running sam local start-api on each subsequent invocation.
Declare a global variable. Modify variable. Run sam local start-api Run multiple invocations and notice that the global variable always gets reset.
sam local start-api
Please provide command output with --debug flag set.
--debug
I would expect global variable context to be preserved.
sam --version
Add --debug flag to command you are running
This is not a bug, it's by design. Local invoke tears down the container and starts a new container. It mimics Lambda "cold starts" on every invoke.
Description
Not sure if this is a bug, or a feature request, but global variables are reset when running sam local start-api on each subsequent invocation.
Steps to reproduce
Declare a global variable. Modify variable. Run
sam local start-api
Run multiple invocations and notice that the global variable always gets reset.Observed result
Please provide command output with
--debug
flag set.Expected result
I would expect global variable context to be preserved.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 0.30.0Add --debug flag to command you are running