diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index a2115a95..f93fdd24 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -10,10 +10,6 @@ const API_BASE = (import.meta.env.VITE_DASHBOARD_API_BASE_URL ?? "").replace( "" ) -if (!API_BASE && typeof window !== "undefined") { - console.warn("VITE_DASHBOARD_API_BASE_URL is not set") -} - const GITHUB_IMAGE_HOST_RE = /^(?:www\.)?github\.com$|\.githubusercontent\.com$/i diff --git a/ui/vite.config.ts b/ui/vite.config.ts index f320b2e2..c179137b 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -92,6 +92,13 @@ function backendProxyRouteRules(): // ship a build whose API calls 404, which is exactly how the previous approach broke. const onVercel = !!process.env.VERCEL || process.env.NITRO_PRESET === "vercel" + if (onVercel && process.env.VITE_DASHBOARD_API_BASE_URL) { + throw new Error( + "VITE_DASHBOARD_API_BASE_URL must not be set on Vercel builds - the API is " + + "same-origin via the LANGGRAPH_BACKEND_URL CDN proxy. A baked-in absolute " + + "API base sends OAuth logins to the backend host and breaks the state cookie.", + ) + } if (!backend) { if (onVercel) { throw new Error(