You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to use with AWS Lambda (ie. w/o env vars)? #277
Good suggestion. Looking more closely I see that node-lambda (a module for testing and deploying lambda functions) uses dotenv itself, and from it's docs it looks like it uses it to load stuff into process.env. I'm a little confused about how that jives with the assertion that lambda doesn't support environment variables which I've seen in a few places, but that's just academic now.
I'm using Apex, which supports using environment variables with Lambda. It just creates a small wrapper around your lambda handle that sets variables on process.env:
@johnelliott I'm configuring debug module via the Lambda env variables. On the code tab of my lambda configuration, in "Environment variables" section, I added 'DEBUG' with value '*'.
Looking around I see that I also have a line "DEBUG=*" in my deploy.env file for node-lambda, and then in my .env file I have "CONFIG_FILE=deploy.env".
I did a bit of a debug-ectomy on my function for now. I tried setting DEBUG in the AWS console as you mentioned and manually setting process.env.DEBUG in my code. Neither of those worked, so I'll have to give it another shot some time. Thanks 👍
Activity
darkyen commentedon May 31, 2016
@GitTom why can't you use dotenv ? .env files are supported pretty much anywhere, and it can load your environment variables to process.env.*,
GitTom commentedon Jun 1, 2016
Good suggestion. Looking more closely I see that node-lambda (a module for testing and deploying lambda functions) uses dotenv itself, and from it's docs it looks like it uses it to load stuff into process.env. I'm a little confused about how that jives with the assertion that lambda doesn't support environment variables which I've seen in a few places, but that's just academic now.
http://stackoverflow.com/a/37033620/150016
freewil commentedon Jun 10, 2016
I'm using Apex, which supports using environment variables with Lambda. It just creates a small wrapper around your lambda handle that sets variables on
process.env:thebigredgeek commentedon Dec 14, 2016
See #370. Closing
GitTom commentedon Jan 19, 2017
For the record, AWS Lambda recently added support for environment variables.
johnelliott commentedon May 24, 2017
@GitTom how did you specify the variables? I can't get debug to turn on regardless of what I set in the AWS console.
GitTom commentedon May 25, 2017
@johnelliott I'm configuring debug module via the Lambda env variables. On the code tab of my lambda configuration, in "Environment variables" section, I added 'DEBUG' with value '*'.
Looking around I see that I also have a line "DEBUG=*" in my deploy.env file for node-lambda, and then in my .env file I have "CONFIG_FILE=deploy.env".
johnelliott commentedon May 25, 2017
Thanks @GitTom for replying.
I did a bit of a debug-ectomy on my function for now. I tried setting
DEBUGin the AWS console as you mentioned and manually setting process.env.DEBUG in my code. Neither of those worked, so I'll have to give it another shot some time. Thanks 👍hrushilok commentedon Apr 27, 2018
@GitTom
how do you set environment variables from .env file in following syntax?
aws lambda create-function \ --environment Variables= \jamesarosen commentedon Oct 7, 2019
For posterity: Lambda@Edge functions don't support environment variables, so dotenv or similar is the only way to go for those.