wjarjoui
wjarjoui•17mo ago

thread about NODE_ENV

Happy to hop on a quick call and walk you through it or move it to DM to save this channel
10 Replies
ballingt
ballingt•17mo ago
here's a thread to save the channel
wjarjoui
wjarjouiOP•17mo ago
I literally modified one of my existing queries in convex/ to also console.log(process.env.NODE_ENV) then deployed it to prod (we're not taking real traffic yet) and ran that query from the functions dashboard, it printed log development
ballingt
ballingt•17mo ago
Great, thanks!
presley
presley•17mo ago
yeah, you are right, I can repro Thanks for the report.
wjarjoui
wjarjouiOP•17mo ago
definitely. If you guys do end up supporting it, would certainly be useful. just please confirm when you rule it out from affecting any convex services 🙂
ballingt
ballingt•17mo ago
We've ruled this out affecting anything with Convex services. It looks like this is default esbuild behavior, the bundler used before sending code to Convex.
erquhart
erquhart•17mo ago
Not only does the bundler set NODE_ENV, it overrides any value set for it in the environment variables panel. Just discovered this trying to limit cron jobs to prod. I'll use ENVIRONMENT or CONVEX_ENV, both of which make more sense becuase most convex code isn't running in node anyway, but just a heads up. Probably docs worthy.
wjarjoui
wjarjouiOP•16mo ago
good to know about CONVEX_ENV, if this is supported by not documented, would be good to get an official word
ballingt
ballingt•16mo ago
Note that CONVEX_ENV is just an example that erquhart came up with, you'd have to set that yourself.
wjarjoui
wjarjouiOP•16mo ago
Ah ok. Wasn't clear

Did you find this page helpful?