-
Notifications
You must be signed in to change notification settings - Fork 944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with AWS Lambda (ie. w/o env vars)? #277
Comments
@GitTom why can't you use dotenv ? .env files are supported pretty much anywhere, and it can load your environment variables to process.env.*, |
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 try {
var config = require('./.env.json')
for (var key in config) {
process.env[key] = config[key]
}
} catch (err) {
// ignore
}
exports.handle = require('./index').handle |
See #370. Closing |
For the record, AWS Lambda recently added support for environment variables. |
@GitTom how did you specify the variables? I can't get debug to turn on regardless of what I set in the AWS console. |
@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". |
Thanks @GitTom for replying. I did a bit of a debug-ectomy on my function for now. I tried setting |
@GitTom |
For posterity: Lambda@Edge functions don't support environment variables, so dotenv or similar is the only way to go for those. |
AWS Lambda does not support environment variables:
http://stackoverflow.com/questions/36230545/how-can-i-use-environmental-variables-on-aws-lambda/
Is there some other way to configure debug that would work with Lambda?
Or is there some other module like debug that works with Lambda?
The text was updated successfully, but these errors were encountered: