Vercel loading production env variables in preview deployments

I'm deploying my project to Vercel and I'm having problems because even on Preview deployments the production environment variables are being loaded. I have two databases and Firebase apps, one for production and one for dev, but it's always loading the production configs. When printing process.env.NODE_ENV, the value is production in both Preview and Production deployments. Any tips?
3 Replies
chungweileong
chungweileong2y ago
NODE_ENV is not meant for "production", "staging", "preview", it usually used to indicate the build environment, which mostly used by build tool.
Matvey
Matvey2y ago
use VERCER_ENV instead of NODE_ENV
Victor Costelini
Victor CosteliniOP2y ago
Thanks, guys!
Want results from more Discord servers?
Add your server