wjarjoui
wjarjoui9mo ago

`process.env.NODE_ENV` returning an unexpected value

I have my dev deployment configured to have NODE_ENV=wissam , however, when I run console.log(process.env.NODE_ENV) the result is development
3 Replies
erquhart
erquhart9mo ago
Do you have NODE_ENV set in your convex dev deployment? Oh, here's your answer: https://discord.com/channels/1019350475847499849/1178924136010088489/1178936731475644488 (it's hardcoded to "development" for right now)
wjarjoui
wjarjouiOP9mo ago
Yes it is set. ok roger that, so it's a feature not a bug, understood.
lee
lee9mo ago
btw this is a byproduct of convex using esbuild to bundle code. esbuild replaces occurrences of process.env.NODE_ENV with 'development' in source code. So as far as the convex runtime is concerned, it's not an env variable anymore, it's a string. https://esbuild.github.io/api/#platform

Did you find this page helpful?