Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/fix-project-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@workflow/cli": patch
"@workflow/core": patch
"@workflow/web": patch
"@workflow/world-vercel": patch
---

Fix `projectConfig.projectId` to contain the real project ID instead of the project name
6 changes: 5 additions & 1 deletion packages/cli/src/lib/inspect/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const getEnvVars = (): Record<string, string> => {
WORKFLOW_VERCEL_ENV: env.WORKFLOW_VERCEL_ENV || '',
WORKFLOW_VERCEL_AUTH_TOKEN: env.WORKFLOW_VERCEL_AUTH_TOKEN || '',
WORKFLOW_VERCEL_PROJECT: env.WORKFLOW_VERCEL_PROJECT || '',
WORKFLOW_VERCEL_PROJECT_NAME: env.WORKFLOW_VERCEL_PROJECT_NAME || '',
WORKFLOW_VERCEL_TEAM: env.WORKFLOW_VERCEL_TEAM || '',
WORKFLOW_LOCAL_UI: env.WORKFLOW_LOCAL_UI || '',
PORT: env.PORT || '',
Expand Down Expand Up @@ -189,7 +190,10 @@ export const inferVercelEnvVars = async () => {
const inferredProject = await inferVercelProjectAndTeam();
if (inferredProject) {
const { projectId, projectName, teamId } = inferredProject;
envVars.WORKFLOW_VERCEL_PROJECT = projectName || projectId;
// WORKFLOW_VERCEL_PROJECT is the real project ID (e.g., prj_xxx)
envVars.WORKFLOW_VERCEL_PROJECT = projectId;
// WORKFLOW_VERCEL_PROJECT_NAME is the project slug (e.g., my-app)
envVars.WORKFLOW_VERCEL_PROJECT_NAME = projectName || projectId;
Comment on lines +193 to +196
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inferVercelEnvVars() only populates WORKFLOW_VERCEL_PROJECT_NAME (and normalizes WORKFLOW_VERCEL_PROJECT to a real prj_… id) when either WORKFLOW_VERCEL_PROJECT or WORKFLOW_VERCEL_TEAM is missing. If the CLI flag/env already sets WORKFLOW_VERCEL_PROJECT to a project slug/name (which the --project flag description currently implies), this block won’t run, and the world will continue sending the slug in the x-vercel-project-id header—reintroducing the exact bug this PR is fixing and potentially breaking auth/encryption context. Consider expanding the guard to also run when WORKFLOW_VERCEL_PROJECT_NAME is missing and/or when WORKFLOW_VERCEL_PROJECT doesn’t look like a Vercel project id (e.g. not prj_…), so the env vars are consistently normalized.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inference logic normalizes the env var to a real project ID when the linked project is available. If the user sets WORKFLOW_VERCEL_PROJECT to a slug, the inference step replaces it with the real ID from .vercel/project.json.

envVars.WORKFLOW_VERCEL_TEAM = teamId;
writeEnvVars(envVars);
} else {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/lib/inspect/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export async function launchWebUI(
envVars.WORKFLOW_TARGET_WORLD
);
const teamSlug = envVars.WORKFLOW_VERCEL_TEAM;
const projectName = envVars.WORKFLOW_VERCEL_PROJECT;
const projectName =
envVars.WORKFLOW_VERCEL_PROJECT_NAME || envVars.WORKFLOW_VERCEL_PROJECT;

// Check if user wants local UI via flag or environment variable
const useLocalUi = flags.localUi;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/runtime/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const createWorld = (): World => {
projectConfig: {
environment: process.env.WORKFLOW_VERCEL_ENV,
projectId: process.env.WORKFLOW_VERCEL_PROJECT,
projectName: process.env.WORKFLOW_VERCEL_PROJECT_NAME,
teamId: process.env.WORKFLOW_VERCEL_TEAM,
},
});
Expand Down
5 changes: 5 additions & 0 deletions packages/web/app/server/workflow-server-actions.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,15 @@ const WORLD_ENV_ALLOWLIST_BY_TARGET_WORLD: Record<string, string[]> = {
'WORKFLOW_VERCEL_ENV',
'WORKFLOW_VERCEL_TEAM',
'WORKFLOW_VERCEL_PROJECT',
'WORKFLOW_VERCEL_PROJECT_NAME',
'WORKFLOW_VERCEL_AUTH_TOKEN',
],
'@workflow/world-vercel': [
'WORKFLOW_TARGET_WORLD',
'WORKFLOW_VERCEL_ENV',
'WORKFLOW_VERCEL_TEAM',
'WORKFLOW_VERCEL_PROJECT',
'WORKFLOW_VERCEL_PROJECT_NAME',
'WORKFLOW_VERCEL_AUTH_TOKEN',
],

Expand Down Expand Up @@ -432,6 +434,9 @@ async function getWorldFromEnv(userEnvMap: EnvMap): Promise<World> {
projectId:
userEnvMap.WORKFLOW_VERCEL_PROJECT ||
process.env.WORKFLOW_VERCEL_PROJECT,
projectName:
userEnvMap.WORKFLOW_VERCEL_PROJECT_NAME ||
process.env.WORKFLOW_VERCEL_PROJECT_NAME,
teamId:
userEnvMap.WORKFLOW_VERCEL_TEAM || process.env.WORKFLOW_VERCEL_TEAM,
},
Expand Down
3 changes: 3 additions & 0 deletions packages/world-vercel/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export interface APIConfig {
token?: string;
headers?: RequestInit['headers'];
projectConfig?: {
/** The real Vercel project ID (e.g., prj_xxx) */
projectId?: string;
/** The project name/slug (e.g., my-app), used for dashboard URLs */
projectName?: string;
teamId?: string;
environment?: string;
};
Expand Down
Loading