The app runs on a shared server at namecheap. When I hardcode the env variable as a regular variable inside server.js
like let MONGO_URL=blablabla
the app works OK.
When i use process.env.MONGO_URL
instead, it crashes. Any ideas why it is happening?
note: I have my env variable installed on node console of cpanel.
note2: The problem is not MONGO_URL, using process.env.PORT
crashes the app too.
2
Answers
Solved.
Added to the server.js
And switched the app mode to "production". Now
process.env
works.is there
process.env.MONGO_URL
in list of variable that you installed on node console of cpanel?if it is not, put it on that list and try again