fix(console): disable MSW in Vercel production build so requests reach the real backend#1243
Merged
xuyushun441-sys merged 1 commit intomainfrom Apr 17, 2026
Merged
Conversation
…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>
Copilot created this pull request from a session on behalf of
xuyushun441-sys
April 17, 2026 04:41
View session
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
demo.objectui.org/apps/crm_enterprise/leadrendered "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 neithercrm_enterprisenorlead. The console never actually reacheddemo.objectstack.ai.Root cause
apps/console/vercel.json'sbuildCommandinvokedvite builddirectly, bypassing thepackage.jsonbuildscript that setsVITE_USE_MOCK_SERVER=false.main.tsxtreats any value other than the literal string'false'as truthy and callsstartMockServer(), so the service worker registered and intercepted all backend traffic.ObjectView.tsxthen fell through to itsobjectNotFoundempty state because the MSW seed (built fromexamples/crm+todo+kitchen-sink) doesn't contain that app/object.Changes
apps/console/vercel.json— inlineVITE_USE_MOCK_SERVER=falseintobuildCommandso production builds skip MSW and honorVITE_SERVER_URL.apps/console/README.md— new Vercel Deployment section documenting the requiredVITE_SERVER_URLenv var and cross-origin prerequisites (CORS allow-list for the SPA origin,SameSite=None; Secureauth cookies).CHANGELOG.md— entry under Unreleased → Fixed.Deployment follow-up (out of repo)
After merge, set
VITE_SERVER_URL=https://demo.objectstack.aiin the Vercel project and redeploy. The backend must (a) allow CORS fromhttps://demo.objectui.orgwith credentials, (b) issueSameSite=None; Securesession cookies, and (c) actually register thecrm_enterpriseapp andleadobject — otherwise the object not found state will correctly reflect backend metadata.