Are Vercel deployment environments supposed to be case-sensitive in CLI/programmatic contexts?

We were trying to do vercel env pull in our CI environment and noticed that the following fails, counter to our assumptions:

vercel env pull .env.preview \
    --yes \
    --environment Preview
Vercel CLI 49.1.2
> Overwriting existing .env.preview file
> Downloading `Preview` Environment Variables for X/Y
Error: Invalid request: 'target' value of 'Preview' references an environment that does not exist.

Whereas the following passes:

vercel env pull .env.preview \
    --yes \
    --environment preview
Vercel CLI 49.1.2
> Overwriting existing .env.preview file
> Downloading `preview` Environment Variables for X/Y

Changes:
+ VERCEL_OIDC_TOKEN (Updated)

✅  Updated .env.preview file  [342ms]

So I wanted to know a few things:

  1. Is Vercel supposed to care about case-sensitivity of the deployment environment names — for both built-in (Production, Preview) and custom ones we create?
  2. And is the above just a bug in the CLI/backend, if that’s the case? It would seem like case-sensitivity matters, based on the error but then it’s confusing why Vercel dashboard would capitalize the environment name while the CLI expects lowercased name.

Another observation: I notice that when Vercel GitHub app is integrated, even the GitHub environment names that get created match the same case as defined on Vercel side. E.g. I created a staging environment and I noticed a similar env now exists in GitHub environments.

Yes, Vercel deployment environments are case-sensitive in CLI and programmatic contexts. The built-in environments should be referenced as:

  • production (lowercase)
  • preview (lowercase)
  • development (lowercase)

The CLI expects lowercase environment names even though the Vercel Dashboard might display them with capitalization for UI appearance. For custom environments you create, they should also be referenced exactly as you named them with the same case sensitivity

1 Like

Thanks for the response, I’ll keep this in mind for our workflows/scripts. But I wish Vercel app would sync environments then to GitHub under the same name used in programmatic contexts. I set up a new project couple hours back and I see the following on GitHub:

I get that GitHub envs are case-insensitive as per docs but still, would’ve been nice if this was consistently managed.