I’m experiencing a strange issue with environment variables in my Vercel production environment. Sometimes, my app correctly accesses the environment variables configured for production. However, at other times, it either doesn’t access them or seems to be using environment variables from another environment
This is causing erratic behavior, such as receiving production users’ emails in my testing email account.
I’ve double-checked my configuration in the Vercel dashboard, and everything seems correct. Has anyone encountered similar issues or have suggestions on what might be causing this?
I’m having an issue with the environment variable that sets the environment behaviour, I mean the one that states if you are in “LOCAL”, “DEVELOPMENT” or “PROD”.
I tried redeploying and purging the cache. I did not try to remove all env vars and re-adding them.
Do you deploy the project with the automated GitHub integration, with Vercel CLI, or with a combination of methods? If you use the CLI to deploy from local or GitHub Actions, you should make sure you include the --prod option for production deployments and leave it off for preview deployments.