System Environment Variables Overview
Vercel Environment variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed.Vercel provides a set of Environment Variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed.
To expose them to your Deployments, make sure Automatically expose System Environment Variables is checked in your Project Settings.
If you are using a Framework for your Project, Vercel provides prefixed Environment Variables, which you can find in the table below:
When you choose to automatically expose System Environment Variables, some
React warnings, such as those in a create-react-app will display as build
errors. For more information on this error, see How do I resolve a
process.env.CI = true
error?
Name | Description |
---|---|
VERCEL | An indicator to show that System Environment Variables have been exposed to your project's Deployments. Example: 1 . |
CI | An indicator that the code is running in a Continuous Integration environment. Example: 1 . Note: This Variable is only exposed during Build Step. |
VERCEL_ENV | The Environment that the app is deployed and running on. The value can be either production , preview , or development . |
VERCEL_URL | The domain name of the generated deployment URL. Example: *.vercel.app . The value does not include the protocol schemehttps:// . Note: This Variable cannot be used in conjunction with Standard Deployment Protection. See Migrating to Standard Protection. |
VERCEL_BRANCH_URL | The domain name of the generated Git branch URL. Example: *-git-*.vercel.app . The value does not include the protocol scheme https:// . |
VERCEL_REGION | The ID of the Region where the app is running. Example: cdg1 . Note: This Variable is only exposed during Runtime for Vercel Functions. |
VERCEL_DEPLOYMENT_ID | The unique identifier for the deployment, which can be used to implement Skew Protection. Example: dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3 . |
VERCEL_SKEW_PROTECTION_ENABLED | When Skew Protection is enabled in Project Settings, this value is set to 1 . Example: 1 . |
VERCEL_AUTOMATION_BYPASS_SECRET | The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings. |
VERCEL_GIT_PROVIDER | The Git Provider the deployment is triggered from. Example: github . |
VERCEL_GIT_REPO_SLUG | The origin repository the deployment is triggered from. Example: my-site . |
VERCEL_GIT_REPO_OWNER | The account that owns the repository the deployment is triggered from. Example: acme . |
VERCEL_GIT_REPO_ID | The ID of the repository the deployment is triggered from. Example: 117716146 . |
VERCEL_GIT_COMMIT_REF | The git branch of the commit the deployment was triggered by. Example: improve-about-page . |
VERCEL_GIT_COMMIT_SHA | The git SHA of the commit the deployment was triggered by. Example: fa1eade47b73733d6312d5abfad33ce9e4068081 . |
VERCEL_GIT_COMMIT_MESSAGE | The message attached to the commit the deployment was triggered by. Example: Update about page . |
VERCEL_GIT_COMMIT_AUTHOR_LOGIN | The username attached to the author of the commit that the project was deployed by. Example: johndoe . |
VERCEL_GIT_COMMIT_AUTHOR_NAME | The name attached to the author of the commit that the project was deployed by. Example: John Doe . |
VERCEL_GIT_PREVIOUS_SHA | The git SHA of the last successful deployment for the project and branch. Example: fa1eade47b73733d6312d5abfad33ce9e4068080 . Note: This Variable is only exposed when an Ignored Build Step is provided. |
VERCEL_GIT_PULL_REQUEST_ID | The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string. Example: 23 . |
Frameworks typically use a prefix in order to expose Environment Variables to the browser.
The following prefixed Environment Variables will be available during the Build Step, based on the Project's selected Framework Preset.
Name | Description |
---|---|
NEXT_PUBLIC_VERCEL_ENV | The Environment that the app is deployed and running on. The value can be either production , preview , or development . |
NEXT_PUBLIC_VERCEL_URL | The domain name of the generated deployment URL. Example: *.vercel.app . The value does not include the protocol schemehttps:// . Note: This Variable cannot be used in conjunction with Standard Deployment Protection. See Migrating to Standard Protection. |
NEXT_PUBLIC_VERCEL_BRANCH_URL | The domain name of the generated Git branch URL. Example: *-git-*.vercel.app . The value does not include the protocol scheme https:// . |
NEXT_PUBLIC_VERCEL_AUTOMATION_BYPASS_SECRET | The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings. |
NEXT_PUBLIC_VERCEL_GIT_PROVIDER | The Git Provider the deployment is triggered from. Example: github . |
NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG | The origin repository the deployment is triggered from. Example: my-site . |
NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER | The account that owns the repository the deployment is triggered from. Example: acme . |
NEXT_PUBLIC_VERCEL_GIT_REPO_ID | The ID of the repository the deployment is triggered from. Example: 117716146 . |
NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF | The git branch of the commit the deployment was triggered by. Example: improve-about-page . |
NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA | The git SHA of the commit the deployment was triggered by. Example: fa1eade47b73733d6312d5abfad33ce9e4068081 . |
NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE | The message attached to the commit the deployment was triggered by. Example: Update about page . |
NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_LOGIN | The username attached to the author of the commit that the project was deployed by. Example: johndoe . |
NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_NAME | The name attached to the author of the commit that the project was deployed by. Example: John Doe . |
NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_ID | The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string. Example: 23 . |
System Environment Variables will be populated with an empty string if the
value is not applicable, for example when running
vercel dev
during
Development or if the Deployment is not
triggered by a Git Commit.
Many frontend frameworks require prefixes on environment variable names to make them available to the client, such as NEXT_PUBLIC_
for Next.js or PUBLIC_
for SvelteKit. Vercel adds these prefixes automatically for your production and preview deployments, but not for your local development environment.
Framework environment variables are not prefixed when pulled into your local development environment with vercel env pull
. For example, VERCEL_ENV
will not be prefixed to NEXT_PUBLIC_VERCEL_ENV
.
To use framework-prefixed environment variables locally:
- Define them in your project settings with the appropriate prefix
- Scope them to
Development
- Pull them into your local environment with Vercel CLI using the
vercel env pull
command
Was this helpful?