Hi,
I have a project that uses NODE_ENV
variables. In my development environment (localhost), it’s correctly set to “development,” and on the main branch (deployed website), it’s automatically set to “production” as expected.
The issue arises with a custom branch I created, named “dev,” which is meant to serve as a test branch using a “development” environment. However, Vercel treats it as a preview branch, assigning it the “production” NODE_ENV
value. I’ve tried changing both the NODE_ENV
and VERCEL_ENV
variables, but the environment still defaults to “production.”
This is problematic because this custom branch is not intended to use the same environment settings as production. I don’t want it to:
- Send data reports to the same endpoints as my production environment.
- Use the same production database; instead, I would prefer to use a replica for testing purposes.
- Prevent logging in the browser for the deployed website, but allow it for staging and development.
Ultimately, I need the ability to set the NODE_ENV
to “development” or “test” for this custom branch instead of “production.” Could you guide me on how to achieve this with Vercel?
Thanks in advance