AWS Lambda Environment Variables not set, process.env undefined in Node

Even though the toolbar for the lambda function shows me NODE_ENVwhat is specified as an environment variable, it process.env.NODE_ENVis undefined when I run the Node AWS lambda function.

This code ...

console.log('node process env NODE_ENV:');
console.log(process.env.NODE_ENV);

logs this:

node process env NODE_ENV:
undefined

I was wondering if this was a problem with the role, so I gave her all the rights to AWS Lambda, but that didn't help.

For what it's worth, I'm using the Claudia bot builder running the npm script

"deploy:production": "claudia update --version production --set-env NODE_ENV=production",

But, as I said, the environment is NODE_ENVdisplayed in the list of environment variables on the toolbar for this function.

Any ideas?

+4
source share
1
+2

Source: https://habr.com/ru/post/1676388/


All Articles