| 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";
**`syncVercelEnvVars` is deprecated.** If you are using the [Vercel integration](/vercel-integration), do not use this extension — the integration handles environment variable syncing natively. Using both together can cause env vars to be incorrectly populated.To sync environment variables, you just need to add our build extension to your trigger.config.ts file. This extension will then automatically run 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