Skip to content

Commit 58e67ce

Browse files
authored
fix(core): suppress stale WORKFLOW_VERCEL_* env var warning outside serverless runtime (vercel#1345)
The warning about WORKFLOW_VERCEL_* env vars having no effect at runtime was incorrectly shown when the Workflow CLI or web observability app was running. These tools intentionally set those env vars. Gate the warning on VERCEL=1 so it only fires inside Vercel serverless functions where the env vars are truly unnecessary.
1 parent 7f26695 commit 58e67ce

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

.changeset/funny-doors-allow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@workflow/core": patch
3+
---
4+
5+
Suppress stale `WORKFLOW_VERCEL_*` env var warning when running outside Vercel serverless (e.g. CLI, web observability app)

packages/core/src/runtime/world.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@ export const createWorld = (): World => {
3434
const targetWorld = resolveWorkflowTargetWorld();
3535

3636
if (isVercelWorldTarget(targetWorld)) {
37-
// Warn if WORKFLOW_VERCEL_* env vars are set — they have no effect at
38-
// runtime and likely indicate a misconfiguration (user manually added
39-
// them as Vercel project env vars, which is not needed).
37+
// Warn if WORKFLOW_VERCEL_* env vars are set inside a Vercel serverless
38+
// function (VERCEL=1) — they have no effect at runtime and likely indicate
39+
// a misconfiguration (user manually added them as Vercel project env vars,
40+
// which is not needed). We gate on VERCEL=1 so the warning does not fire
41+
// when the CLI or web observability app sets these env vars intentionally.
4042
const staleEnvVars = [
4143
'WORKFLOW_VERCEL_PROJECT',
4244
'WORKFLOW_VERCEL_TEAM',
4345
'WORKFLOW_VERCEL_AUTH_TOKEN',
4446
'WORKFLOW_VERCEL_ENV',
4547
].filter((key) => process.env[key]);
46-
if (staleEnvVars.length > 0) {
48+
if (staleEnvVars.length > 0 && process.env.VERCEL === '1') {
4749
console.warn(
4850
`[workflow] Warning: ${staleEnvVars.join(', ')} env var(s) ` +
4951
'are set but have no effect at runtime. These are only used by the Workflow CLI. ' +

0 commit comments

Comments
 (0)