I don’t understand why for my preview environment that the environment is checked as production in the image below. What is the purpose of these. They were set by default. When I try to uncheck and save it is asking for an environment variable to be set. I set a new env VERCEL_ENV=preview. Yet when i enter save, the check mark doesn’t change.
Hey @thesuryapolina-gmail. The Environments
checkboxes indicate which environment should use the variable you’re setting. It works sort of like .env
versus .env.preview
. A common scenario for this is when you need a different database or API connection in preview deployments than in production ones.
You could add MY_TOKEN_VAR
to my_preview_value
with Preview and Development check and Production unchecked. Then, I could add another version of MY_TOKEN_VAR
with the value my_production_value
but uncheck Preview and Development check and check Production before saving this time. Now preview deployments will have the value my_preview_value
anywhere MY_TOKEN_VAR
is used, but production deployments. will have the value my_production_value
in those same places.
The VERCEL_ENV
value is automatically set for each deployment because it is a System Environment Variable. You don’t actually need to add that one yourself.
Thanks for the swift response ! Now I understand .
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.