The Vercel deploy 404'd at `/` because PR #75's `vercel-build` script
(`scripts/build-vercel-output.mjs`) ran `rm -rf .vercel/output` and rebuilt
it from `.output/public`. On Vercel CI, Nitro's Vercel preset auto-activates
(from the VERCEL env var) and emits the Build Output API layout to
`.vercel/output` itself during `vite build`; the script then clobbered that
correct output with a static-only config that could not resolve the SPA
`_shell.html` fallback or the server functions, so production returned
`404: NOT_FOUND` even though the build was READY.
Stop fighting Nitro and drive the proxy through it instead:
- Remove `scripts/build-vercel-output.mjs` and the `vercel-build` script;
restore the plain `vite build` for both local and Vercel builds.
- Add an env-driven Nitro `routeRules` proxy in `vite.config.ts`. Nitro's
Vercel preset compiles a plain external-URL `proxy` rule into a CDN-level
rewrite in `.vercel/output/config.json` at build time, reading
LANGGRAPH_BACKEND_URL (the per-project Vercel env var). Proxy, not redirect,
so the osw_session cookie stays first-party (same-origin). The build fails
loudly if LANGGRAPH_BACKEND_URL is missing on Vercel; the rule is omitted
for plain local/off-Vercel builds (which use the E2E_HARNESS mock proxy).
- `vercel.json`: `buildCommand` back to `bun run build`; drop the
`.output/public` outputDirectory so Vercel serves Nitro's `.vercel/output`.
Validated with `LANGGRAPH_BACKEND_URL=... NITRO_PRESET=vercel bun run build`:
the generated `.vercel/output/config.json` contains the
`/dashboard/api/(.*)` -> backend rewrite ahead of `handle: filesystem` and
the SPA catch-all, `_shell.html` and the 699 hashed assets are emitted, and
typecheck passes. Supersedes the broken approach in #75.
Generate the /dashboard/api/* proxy destination at build time from
LANGGRAPH_BACKEND_URL via the Vercel Build Output API, instead of hardcoding
it in ui/vercel.json. This lets the dev and main branches stay byte-identical
(required by the fast-forward-only prod promotion) while each Vercel project
proxies to its own LangGraph backend purely via its own env var — so both the
dev and prod dashboards can be git-linked.
- ui/vercel.json: drop the hardcoded rewrites; buildCommand -> bun run vercel-build
- ui/package.json: add vercel-build = vite build && node scripts/build-vercel-output.mjs
- ui/scripts/build-vercel-output.mjs: emit .vercel/output/config.json with
[ proxy /dashboard/api/* -> $LANGGRAPH_BACKEND_URL, filesystem, SPA fallback ];
throws if LANGGRAPH_BACKEND_URL is unset so a misconfig fails the build.
Keeps the app same-origin (no CORS/auth change); preserves the _shell.html SPA
fallback. Set LANGGRAPH_BACKEND_URL per Vercel project (All Environments).
Enable TanStack Start SPA mode so the build prerenders a static shell
(/_shell.html) and emits a fully static bundle under .output/public,
removing the Nitro serverless function from the Vercel deploy. The
dashboard is a thin client (all data via client-side fetch to the
FastAPI /dashboard/api/*), so SSR rendered nothing of value.
Point Vercel at the static output and add a SPA catch-all rewrite to
the shell for client-side routing, keeping the API proxy rewrite first.
PR #1303 was merged before this URL change landed on the branch. Updates
the rewrite destination from the open-swe-test deployment to the prod
open-swe-v3 deployment so openswe.vercel.app proxies to the right
backend.
Browsers (Safari, Brave, Firefox, increasingly Chrome) refuse to set or
send SameSite=None cookies cross-site. With the frontend on
openswe.vercel.app and the API on *.langgraph.app, the osw_session
cookie from `/auth/callback` was being silently dropped, so every
subsequent /me call returned 401.
Adding a Vercel rewrite makes the API same-origin from the browser's
point of view: the request goes to openswe.vercel.app/dashboard/api/...,
Vercel proxies it to the LangSmith deployment, and the Set-Cookie comes
back attributed to openswe.vercel.app — a first-party cookie that all
browsers honour.
Pair with the matching deployment-side config changes:
- GitHub App callback URL → https://openswe.vercel.app/dashboard/api/auth/callback
- DASHBOARD_API_BASE_URL → https://openswe.vercel.app (LangSmith env)
- VITE_DASHBOARD_API_BASE_URL → unset / empty (Vercel env)