0

The following setup does not work:

Setting a config var either via the dashboard or via

heroku config:set TESTVAR=123

using heroku config shows the variable is set.

But then logging into the container using

heroku ps:exec

and logging out the env vars should show the variable set via config:set but it does not:

node -e "console.log(process.env)"

Also using

export

does not show the environment variable.

I tried defining the variable in app.json but to no avail:

"env": { "TESTVAR":{ "required": true },

According to the documentation this should work but unfortunately it does not. Any help is appreciated.

1 Answer 1

1

Try heroku run env instead.

According to the documentation: "The SSH session created by Heroku Exec will not have the config vars set as environment variables (i.e., env in a session will not list config vars set by heroku config:set)."

see this for more information How to get environment variables in live Heroku dyno

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.