process.env.DEBUG not working?
See original GitHub issueFirst, I’m not reopening your recent debate on inline changes to process.env
.
I support the ability to do so, it just that it doesn’t seem to be working for us anymore.
There are specific cases where the ONLY way to set things is via inline code setting those vars. For us, this is Lambda@Edge which do NOT support env vars as regular functions do.
So for us, this is the only way. The top of our functions look something like this… index.js
process.env.DEBUG = 'logger:*';
const AWS = require('aws-sdk');
const Promise = require('bluebird');
const crypto = require('crypto');
const _ = require('lodash');
const logger = require('../_common/utils/logger');
...
/_common/utils/logger
const debug = require('debug');
const log = debug('logger:logs');
log.log = console.log.bind(console);
module.exports = log;
Note: We are using webpack to bundle our lambda functions (Edge Functions need to be tiny). Not sure if that has anything to do with why it would not work.
This was working previously, and now seems to have stopped working. What are we doing wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
process.env.DEBUG not working? · Issue #815 - GitHub
The problem with assigning to process.env.XXX is order of operations. If you don't modify process.env before you require debug the first ...
Read more >Why are my custom process.env not working within dotenv?
dotenv file is not loading environment variables. I'm trying to set an env file locally based on process.env.NODE_ENV . The application would be ......
Read more >Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js application. Learn how to work with them using helpful tools such ......
Read more >process.ProcessEnv.DEBUG JavaScript and Node.js code ...
Best JavaScript code snippets using process.ProcessEnv.DEBUG(Showing top 15 results out of 315) · Most used process functions · Popular in JavaScript.
Read more >process.env variables are not resolved
I have defined my NODE_ENV and PORT in my Run/Debug Configuration, it is working fine, "problem" is that i'm getting a warning that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nm, turns out there is another issue at play unrelated to Debug which may be causing this. I’ll give an update once we sort it out.
Thanks!
On Wed, Dec 8, 2021 at 9:40 AM Qix @.***> wrote:
Without seeing code (and since I don’t use lambdas) it’s really hard to debug. The best advice without more debugging information is what I mentioned before - the assignment needs to come before
debug
is ever initialized.