@@ -11,6 +11,12 @@ type VercelEnvVar = {
1111 gitBranch ?: string ;
1212} ;
1313
14+ /**
15+ * @deprecated Use the [Vercel integration](https://trigger.dev/docs/vercel-integration) instead.
16+ * If you are using the Vercel integration, remove this extension — using both together will cause
17+ * env vars to be incorrectly populated. This extension is still supported for projects that are
18+ * not using the Vercel integration.
19+ */
1420export function syncVercelEnvVars ( options ?: {
1521 projectId ?: string ;
1622 /**
@@ -36,7 +42,16 @@ export function syncVercelEnvVars(options?: {
3642 process . env . VERCEL_PREVIEW_BRANCH ??
3743 ctx . env . VERCEL_PREVIEW_BRANCH ??
3844 ctx . branch ;
39- const isVercelEnv = ! ! ( ctx . env . VERCEL ) ;
45+ const isVercelEnv = ! ! ctx . env . VERCEL ;
46+
47+ if ( isVercelEnv ) {
48+ console . warn (
49+ "[trigger.dev] syncVercelEnvVars: It looks like you are running inside a Vercel build environment. " +
50+ "If you have the Trigger.dev Vercel integration enabled, you should remove syncVercelEnvVars from your " +
51+ "trigger.config.ts — using both together can cause env vars to be incorrectly populated. " +
52+ "See https://trigger.dev/docs/vercel-integration for more information."
53+ ) ;
54+ }
4055
4156 if ( ! projectId ) {
4257 throw new Error (
@@ -89,13 +104,13 @@ export function syncVercelEnvVars(options?: {
89104 if ( ! env . target . includes ( vercelEnvironment ) ) return false ;
90105 if ( isBranchable && env . gitBranch && env . gitBranch !== branch ) return false ;
91106 // When running in Vercel, prefer process.env but fall back to API value
92- const value = isVercelEnv ? ( process . env [ env . key ] ?? env . value ) : env . value ;
107+ const value = isVercelEnv ? process . env [ env . key ] ?? env . value : env . value ;
93108 if ( ! value ) return false ;
94109 return true ;
95110 } )
96111 . map ( ( env : VercelEnvVar ) => {
97112 // When running in Vercel, prefer process.env but fall back to API value
98- const value = isVercelEnv ? ( process . env [ env . key ] ?? env . value ) : env . value ;
113+ const value = isVercelEnv ? process . env [ env . key ] ?? env . value : env . value ;
99114 return {
100115 name : env . key ,
101116 value,
0 commit comments