Skip to content

fix(console): disable MSW in Vercel production build so requests reach the real backend#1243

Merged
xuyushun441-sys merged 1 commit intomainfrom
copilot/test-lead-object-not-found
Apr 17, 2026
Merged

fix(console): disable MSW in Vercel production build so requests reach the real backend#1243
xuyushun441-sys merged 1 commit intomainfrom
copilot/test-lead-object-not-found

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

demo.objectui.org/apps/crm_enterprise/lead rendered "object lead not found" because the Vercel build silently bundled MSW into production — every /api/v1/* call was intercepted in-browser and answered from the mock dataset, which has neither crm_enterprise nor lead. The console never actually reached demo.objectstack.ai.

Root cause

apps/console/vercel.json's buildCommand invoked vite build directly, bypassing the package.json build script that sets VITE_USE_MOCK_SERVER=false. main.tsx treats any value other than the literal string 'false' as truthy and calls startMockServer(), so the service worker registered and intercepted all backend traffic. ObjectView.tsx then fell through to its objectNotFound empty state because the MSW seed (built from examples/crm + todo + kitchen-sink) doesn't contain that app/object.

Changes

  • apps/console/vercel.json — inline VITE_USE_MOCK_SERVER=false into buildCommand so production builds skip MSW and honor VITE_SERVER_URL.
  • apps/console/README.md — new Vercel Deployment section documenting the required VITE_SERVER_URL env var and cross-origin prerequisites (CORS allow-list for the SPA origin, SameSite=None; Secure auth cookies).
  • CHANGELOG.md — entry under Unreleased → Fixed.
// apps/console/vercel.json
"buildCommand": "pnpm msw:init && NODE_OPTIONS=--max-old-space-size=4096 VITE_USE_MOCK_SERVER=false VITE_BASE_PATH=/ vite build"

Deployment follow-up (out of repo)

After merge, set VITE_SERVER_URL=https://demo.objectstack.ai in the Vercel project and redeploy. The backend must (a) allow CORS from https://demo.objectui.org with credentials, (b) issue SameSite=None; Secure session cookies, and (c) actually register the crm_enterprise app and lead object — otherwise the object not found state will correctly reflect backend metadata.

…h the real backend

Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/85a34515-2dbd-4eb1-b164-9078b986ec66

Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui-demo Ready Ready Preview, Comment Apr 17, 2026 4:41am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Apr 17, 2026 4:41am

Request Review

@xuyushun441-sys xuyushun441-sys marked this pull request as ready for review April 17, 2026 04:41
@xuyushun441-sys xuyushun441-sys merged commit cd2839b into main Apr 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants