|
1 | 1 | --- |
2 | 2 | title: "Vercel integration" |
3 | | -description: "When you deploy to Vercel, automatically deploy your associated tasks." |
| 3 | +description: "Automatically deploy your tasks whenever you deploy to Vercel." |
4 | 4 | --- |
5 | 5 |
|
6 | | -import ComingSoon from "/snippets/coming-soon-in-review.mdx" |
| 6 | +## How it works |
7 | 7 |
|
8 | | -<ComingSoon /> |
| 8 | +The Vercel integration connects your Vercel project to your Trigger.dev project so that every Vercel deployment automatically triggers a Trigger.dev deployment. It also syncs environment variables from Vercel into Trigger.dev and supports atomic deployments to keep your app and tasks in sync. |
| 9 | + |
| 10 | +This eliminates the need to manually run the `trigger.dev deploy` command or maintain custom CI/CD workflows for Vercel-based projects. |
| 11 | + |
| 12 | +<Note> |
| 13 | + The Vercel integration requires the [GitHub integration](/github-integration) to be connected as well, since Trigger.dev builds your tasks from your GitHub repository. |
| 14 | +</Note> |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +You can connect Vercel from two entry points: |
| 19 | + |
| 20 | +### From the Trigger.dev dashboard |
| 21 | + |
| 22 | +<Steps> |
| 23 | + |
| 24 | +<Step title="Connect Vercel"> |
| 25 | + Go to your project's **Settings** page and click **Connect Vercel**. This will redirect you to Vercel to authorize the Trigger.dev app. |
| 26 | +</Step> |
| 27 | + |
| 28 | +<Step title="Select a Vercel project"> |
| 29 | + Choose which Vercel project to connect to your Trigger.dev project. |
| 30 | +</Step> |
| 31 | + |
| 32 | +<Step title="Map environments"> |
| 33 | + If your Vercel project has custom environments, choose which one maps to your Trigger.dev staging environment. |
| 34 | +</Step> |
| 35 | + |
| 36 | +<Step title="Sync environment variables"> |
| 37 | + Review the environment variables that will be pulled from Vercel into Trigger.dev. You can deselect any variables you don't want to sync. |
| 38 | +</Step> |
| 39 | + |
| 40 | +<Step title="Configure build settings"> |
| 41 | + Optionally adjust [build settings](#build-settings) for atomic deployments, env var pulling, and new env var discovery. |
| 42 | +</Step> |
| 43 | + |
| 44 | +<Step title="Connect GitHub"> |
| 45 | + If your GitHub repository isn't already connected, you'll be prompted to connect it. |
| 46 | +</Step> |
| 47 | + |
| 48 | +</Steps> |
| 49 | + |
| 50 | +### From the Vercel Marketplace |
| 51 | + |
| 52 | +<Steps> |
| 53 | + |
| 54 | +<Step title="Install the integration"> |
| 55 | + Find Trigger.dev on the Vercel Marketplace and install it. This will redirect you to Trigger.dev to complete setup. |
| 56 | +</Step> |
| 57 | + |
| 58 | +<Step title="Select your Trigger.dev organization and project"> |
| 59 | + Choose which Trigger.dev organization and project to connect. If you're new to Trigger.dev, you'll be guided through creating an organization and project. |
| 60 | +</Step> |
| 61 | + |
| 62 | +<Step title="Connect GitHub"> |
| 63 | + If your GitHub repository isn't already connected, you'll be prompted to connect it. |
| 64 | +</Step> |
| 65 | + |
| 66 | +</Steps> |
| 67 | + |
| 68 | +<Note> |
| 69 | + When installing from the Vercel Marketplace, default build settings are applied automatically. You can adjust them later in your project settings. |
| 70 | +</Note> |
| 71 | + |
| 72 | +## Environment variable sync |
| 73 | + |
| 74 | +The integration syncs environment variables in both directions: |
| 75 | + |
| 76 | +**Vercel → Trigger.dev**: Environment variables from your Vercel project are pulled into Trigger.dev. This happens during the initial setup and optionally before each build. Variables are synced per-environment (production, staging, preview). |
| 77 | + |
| 78 | +**Trigger.dev → Vercel**: Trigger.dev syncs API keys (like `TRIGGER_SECRET_KEY`) to your Vercel project so your app can communicate with Trigger.dev. |
| 79 | + |
| 80 | +The following variables are excluded from the Vercel → Trigger.dev sync: |
| 81 | +- `TRIGGER_SECRET_KEY`, `TRIGGER_VERSION`, `TRIGGER_PREVIEW_BRANCH` (managed by Trigger.dev) |
| 82 | +- Sensitive/secret-type variables (Vercel API limitation) |
| 83 | + |
| 84 | +You can control sync behavior per-variable from your project's Vercel settings. Deselecting a variable prevents its value from being updated during future syncs. |
| 85 | + |
| 86 | +<Tip> |
| 87 | + For dynamic environment variables (e.g., from NeonDB branching), use the `syncEnvVars` build extension instead. Learn more about [environment variables](/deploy-environment-variables). |
| 88 | +</Tip> |
| 89 | + |
| 90 | +## Atomic deployments |
| 91 | + |
| 92 | +Atomic deployments ensure your Vercel app and Trigger.dev tasks are deployed in sync. When enabled, Trigger.dev gates your Vercel deployment until the task build completes, then triggers a Vercel redeployment with the correct `TRIGGER_VERSION` set. This guarantees your app always uses the matching version of your tasks. |
| 93 | + |
| 94 | +Atomic deployments are enabled for the production environment by default. |
| 95 | + |
| 96 | +<Note> |
| 97 | + When atomic deployments are enabled, the integration automatically disables `Auto-assign Custom Production Domains` on your Vercel project. This is required so that Vercel doesn't promote a deployment before the Trigger.dev build is ready. |
| 98 | +</Note> |
| 99 | + |
| 100 | +Previously, setting up atomic deployments with Vercel required custom GitHub Actions workflows. The Vercel integration automates this entirely. For more details on how atomic deployments work, see [Atomic deploys](/deployment/atomic-deployment). |
| 101 | + |
| 102 | +## Environment mapping |
| 103 | + |
| 104 | +The integration maps Vercel environments to Trigger.dev environments: |
| 105 | + |
| 106 | +| Vercel environment | Trigger.dev environment | |
| 107 | +| --- | --- | |
| 108 | +| Production | Production | |
| 109 | +| Custom environment | Staging (you choose which one) | |
| 110 | +| Preview | Preview | |
| 111 | +| Development | Development | |
| 112 | + |
| 113 | +If your Vercel project has a custom environment, you can select which one maps to your Trigger.dev staging environment during setup or in your project settings. |
| 114 | + |
| 115 | +<Note> |
| 116 | + Preview deployments require the preview environment to be enabled on your project. Learn more about [preview branches](/deployment/preview-branches). |
| 117 | +</Note> |
| 118 | + |
| 119 | +## Build settings |
| 120 | + |
| 121 | +You can configure the following settings per-environment from your project's Vercel settings: |
| 122 | + |
| 123 | +- **Atomic deployments**: Controls whether Trigger.dev and Vercel deployments are synchronized. Enabled for production by default. |
| 124 | +- **Pull env vars before build**: When enabled, Trigger.dev pulls the latest environment variables from Vercel before each build. Enabled for production, staging, and preview by default. |
| 125 | +- **Discover new env vars**: When enabled, new environment variables found in Vercel that don't yet exist in Trigger.dev are created automatically during builds. Only available for environments that also have env var pulling enabled. Enabled for production, staging, and preview by default. |
| 126 | + |
| 127 | +## Disconnecting |
| 128 | + |
| 129 | +You can disconnect the Vercel integration from either side: |
| 130 | + |
| 131 | +- **From Trigger.dev**: Go to your project **Settings** and disconnect Vercel. |
| 132 | +- **From Vercel**: Uninstall the Trigger.dev integration from your Vercel dashboard. This is automatically detected and the connection is removed on the Trigger.dev side. |
| 133 | + |
| 134 | +Disconnecting stops automatic deployments, environment variable syncing, and deployment checks. Your existing deployments and environment variables are not affected. |
| 135 | + |
| 136 | +## Related |
| 137 | + |
| 138 | +- [GitHub integration](/github-integration) |
| 139 | +- [Atomic deploys](/deployment/atomic-deployment) |
| 140 | +- [Environment variables](/deploy-environment-variables) |
| 141 | +- [Preview branches](/deployment/preview-branches) |
0 commit comments