AWS Lambda Environment Variables not set, process.env undefined in Node
amazon-web-services, aws-lambda, node.js
Solution
If you got here from a google search:
This could also happen when you define a function named "process" in your code. The function will override the internal node.js "process" variable.
Problem
Even though the dashboard for the Lambda function shows me `NODE_ENV` listed as an environment variable, `process.env.NODE_ENV` is undefined when I run my 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 it was a role issue, so I gave its role all permissions on AWS Lambda, but it didn't help. For what it's worth, I'm using Claudia bot builder, running the npm script ``` "deploy:production": "claudia update --version production --set-env NODE_ENV=production", ``` But like I say, the `NODE_ENV` environment shows in the list of environment variables in the dashboard for the function. Any ideas?