-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAM ignoring --env-vars on local invoke #6145
Comments
Hello @gmariani I faced the same issue, and when I left the env variable with "" blank worked. like this TABLE_NAME: "" |
So I changed template.yaml to:
And it worked. Maybe this should be documented somewhere as it's not obvious that the variables need to exist to be overwritten instead of added in at runtime. |
man, i looked all over that documentation and didn't find/notice that page... sigh, well good to know. I looked here https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/using-sam-cli-local-invoke.html and https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-invoke.html and both just mention that you pass them along, not that it's overriding anything, hence my confusion. Thanks again everyone! |
|
Description:
This worked maybe a year or two ago but when I revisited an existing project it no longer loads the environmental variables.
I added some details but changed names of things to make it more generic. Folder structure looks like:
Steps to reproduce:
In my project I have a
env.json
file with tokens. I then go to test my build via:sam build && sam local invoke --env-vars env.json
Observed result:
None of the parameters in my
env.json
are populated inprocess.env
.Expected result:
To have my parameters from
env.json
populated inprocess.env
.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:SAM CLI, version 1.99.0
node -v
:v19.6.1
Add --debug flag to command you are running
Also here is my
template.yaml
The text was updated successfully, but these errors were encountered: