Skip to content

Commit b0516ea

Browse files
leoisadev8claude
andcommitted
fix: use bun --cwd to preserve environment variables in convex deploy
Changed from 'cd ../web && bun run build' to 'bun --cwd ../web run build' to prevent environment variable loss when changing directories within the --cmd subshell. When using `cd` within convex deploy --cmd, the NEXT_PUBLIC_CONVEX_URL environment variable set by Convex doesn't properly propagate to the subshell, causing "NEXT_PUBLIC_CONVEX_URL is not configured" errors. Using --cwd keeps the command in the same shell, preserving env vars. Fixes: Error: NEXT_PUBLIC_CONVEX_URL is not configured in preview deployments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0a8527a commit b0516ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "module",
55
"scripts": {
66
"dev": "convex dev",
7-
"build": "if [ \"$NEXT_PUBLIC_DEPLOYMENT\" = \"preview\" ]; then convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'cd ../web && bun run build' --preview-run previewSeed --preview-create NEXT_PUBLIC_DEPLOYMENT=preview NEXT_PUBLIC_APP_URL=https://$VERCEL_URL; else convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'cd ../web && bun run build'; fi",
7+
"build": "if [ \"$NEXT_PUBLIC_DEPLOYMENT\" = \"preview\" ]; then convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'bun --cwd ../web run build' --preview-run previewSeed --preview-create NEXT_PUBLIC_DEPLOYMENT=preview NEXT_PUBLIC_APP_URL=https://$VERCEL_URL; else convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'bun --cwd ../web run build'; fi",
88
"check-types": "tsc --noEmit || true",
99
"test": "echo \"No Convex tests yet\""
1010
},

0 commit comments

Comments
 (0)