Vercel

Invalid environment variable prefix

Learn more about errors with invalid environment variable prefixes in Turborepo.

Why this error occurred

When declaring environment variables in your turbo.json, you cannot prefix them with $. This was an old syntax for declaring a dependency on an environment variable that was deprecated in Turborepo 1.5.

./turbo.json
{
  "globalEnv": ["$MY_ENV_VAR"]
}

The environment variable declared above has the $ prefix.

Solution

Remove the $ prefix from your environment variable declaration.

./turbo.json
{
  "globalEnv": ["MY_ENV_VAR"]
}

You can migrate to the env and globalEnv keys using npx @turbo/codemod migrate-env-var-dependencies. Check out the codemod's documentation for more details.