Thursday 4 May 2017

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

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?



via Mikal Madsen

No comments:

Post a Comment