-
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
Not working with dotenv #446
Comments
Isn't this more likely an issue of timing when env is initialized by dotenv and read by debug? In your example you are importing debug and then later configuring dotenv. I am not sure where this is actually handled on debug side, I don't actually see it in a source code. I recommend adding npm script like |
@FredyC @hyperh We get the environment variable within the load function in |
fixed with 2.6.5 |
- by using debugFactory.debug as described here debug-js/debug#446 (comment)
@thebigredgeek It took me a few years to find this comment. Most people just ignore it and replace it eventually if they use the dotenv approach. I guess this should be added to the documentation. From your tip @thebigredgeek a working example should be:
Also, note that the env should have an extra space at the end. (bug?)
Otherwise, it won't work. |
- by using debugFactory.debug as described here debug-js/debug#446 (comment)
We have nothing to do with the Further, if you're Please just heed this advice. Establish your environment variables before node ever executes, however that might look. You'll be much happier in the long run. |
I can't seem to get
debug
working withdotenv
. It works fine when I set the env var from outside of .env like so:package.json
server.js
.env
The text was updated successfully, but these errors were encountered: