Suddenly when I pull environment variables from Vercel, system environment variables like VERCEL_ENV (and everything else) is missing when --environment is not preview or production.
I am running the latest version of Vercel CLI (41.0.2)
This used to work for a number of years, and we have a whole number of build tools using VERCEL_ENV to configure projects successfully. It is also mentioned in the Vercel documentation that these are available in all environments.
As per the docs, the system variables are available in all environments on Vercel, which is different than using the Vercel CLI to pull the environment variables locally.
May I know when was the last time you pull VERCEL_ variables using the CLI successfully? Because it shouldn’t be possible.
Hi @zigavajdic, thanks for sharing the feedback about the docs. I’ll pass it along to the docs team. About the CLI pulling in the VERCEL_ envs, let me confirm with the team if there are alternatives.
this is a regression from what previously worked with vercel cli and I would also add incredibly annoying and frustrating…
as of 28.10.1
it would respect the expose system variables and pull them down for development env vars
now in 41.7.3
it does not
not sure why. this is creating a mismatch between local development, preview and production for env variable and I don’t understand why vercel would want promote that experience
Pulling down local VERCEL_ environment variables for local development was removed because customers would sometimes edit these values locally and find themselves in confusing situations. These prefix variables are intended to only exist once code is deployed to the platform or when running a local environment intended to simulate the platform with vercel dev.
If you run vercel dev, environment variables that are knowable at local runtime should be available as part of the running process (for example, process.env in Node).
You should have access to VERCEL_URL, VERCEL_REGION, NOW_REGION, VERCEL_ENV, VERCEL.
For production, preview and we still allow pulling these locally for customers who have custom build requirements:
So they’ll have them as part of their build, although do note many of the values will not be set (because they’re only known at the moment of deployment).
If you can tell us a bit more about your use case of wanting these available locally for development outside of use with vercel dev we can offer some suggestions.
I’ve abstracted it away now, but these are the only variables in the entire app that are treated differently than the other 50 others, just feels weird to not have the ability to mirror your local development env to what you have in a deployed environment…
makes managing this difference need to happen in the users head. not in env variables.