Global variables are undefined when running local invoke
See original GitHub issueResources:
GithubPushes:
Type: AWS::Serverless::Function
DependsOn:
- Stream
Properties:
Runtime: nodejs8.10
Description: >-
This will verify that the incoming data is from Github and hashed with the key
we are using for this environment
Environment:
Variables:
SECRET: !Sub ${Secret}
works fine when I run
SECRET=foo sam local invoke "GithubPushes" -e fixtures/data.json
but if I move that to Globals then this becomes “undefined”
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Global variables are undefined when running local invoke #380
Global variables are undefined when running local invoke #380 ... SECRET=foo sam local invoke "GithubPushes" -e fixtures/data.json.
Read more >Why a variable defined global is undefined? - Stack Overflow
So the local variable's value is undefined before that line, and has a value after, but neither one are touching the global variable....
Read more >Why can't I access global variables inside my function in ...
create a new local variable with the same name as globalVariable. globalVariable and give it a value. Log this new local variable. You'd...
Read more >Javascript global variable is undefined,why? - CodeProject
Here variable declared but not set value. First you need to set value either by calling veg7() function or veg10() function, then you...
Read more >Detecting Undefined Variables - lua-users wiki
Reads from and writes to undefined globals can be detected when they happen, at run-time. These approaches operate by overriding the __index ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For ref. https://whatibroke.com/2019/01/15/overriding-global-variables-aws-sam-local/
This is solved in the latest release - https://github.com/awslabs/aws-sam-cli/releases/tag/v0.3.0.