| title | Syncing environment variables from your Vercel projects |
|---|---|
| sidebarTitle | Vercel sync env vars |
| description | This example demonstrates how to sync environment variables from your Vercel project to Trigger.dev. |
import VercelDocsCards from "/snippets/vercel-docs-cards.mdx";
**Deprecated when using the Vercel integration.** If you are using the [Vercel integration](/vercel-integration), do not use `syncVercelEnvVars` — the integration handles env var syncing natively and using both together can cause env vars to be incorrectly populated.If you are not using the Vercel integration, syncVercelEnvVars is still supported. Continue
with the configuration below.
If you are not using the Vercel integration, you can sync environment variables manually by adding the syncVercelEnvVars build extension to your trigger.config.ts file. This extension will run automatically every time you deploy your Trigger.dev project.
import { defineConfig } from "@trigger.dev/sdk";
import { syncVercelEnvVars } from "@trigger.dev/build/extensions/core";
export default defineConfig({
project: "<project ref>",
// Your other config settings...
build: {
// Add the syncVercelEnvVars build extension
extensions: [
syncVercelEnvVars({
// A personal access token created in your Vercel account settings
// Used to authenticate API requests to Vercel
// Generate at: https://vercel.com/account/tokens
vercelAccessToken: process.env.VERCEL_ACCESS_TOKEN,
// The unique identifier of your Vercel project
// Found in Project Settings > General > Project ID
projectId: process.env.VERCEL_PROJECT_ID,
// Optional: The ID of your Vercel team
// Only required for team projects
// Found in Team Settings > General > Team ID
vercelTeamId: process.env.VERCEL_TEAM_ID,
}),
],
},
});To sync the environment variables, all you need to do is run our deploy command. You should see some output in the console indicating that the environment variables have been synced, and they should now be available in your Trigger.dev dashboard.
npx trigger.dev@latest deploy