Fix self-hosted editor: serve dist/ assets and default COLLAB_EMBEDDED_WS#40
Closed
michael-ford wants to merge 1 commit intoEveryInc:mainfrom
Closed
Fix self-hosted editor: serve dist/ assets and default COLLAB_EMBEDDED_WS#40michael-ford wants to merge 1 commit intoEveryInc:mainfrom
michael-ford wants to merge 1 commit intoEveryInc:mainfrom
Conversation
…D_WS Two issues prevent the editor from loading in local self-hosted mode: 1. The server reads dist/index.html for the SPA shell but does not mount express.static for dist/, so the built JS bundle (assets/editor.js) returns 404. 2. Without COLLAB_EMBEDDED_WS=1, the collab-session endpoint returns a WebSocket URL on port+1 (e.g. 4001) even though the embedded runtime multiplexes WebSocket connections on the main HTTP port (4000). The editor connects to a non-existent server and never syncs document content.
Author
|
Closing in favor of #30 which covers the same two fixes. Their approach of setting COLLAB_EMBEDDED_WS=1 inside startCollabRuntimeEmbedded is cleaner than requiring it in .env. |
5 tasks
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.
Summary
Two issues prevent the editor from loading when running the Proof SDK locally:
dist/: The server readsdist/index.htmlfor the SPA shell but never mountsexpress.staticfor thedist/directory, soassets/editor.jsreturns 404 and the editor stays on "Loading editor..."COLLAB_EMBEDDED_WS: TheresolveRequestScopedCollabWsBasefunction defaults toport+1(4001) for loopback hosts, but the embedded collab runtime multiplexes on the main HTTP port (4000). The editor connects, but Yjs never syncs — the document appears empty.Changes
server/index.ts: Addexpress.static(path.join(__dirname, '..', 'dist'))so built assets are served.env.example: AddCOLLAB_EMBEDDED_WS=1socp .env.example .envgives a working local setupTest plan
npm run build && npm run serve→ openhttp://localhost:4000/d/<slug>?token=<token>→ editor loads with document contentws://localhost:4000/ws(not 4001)