Skip to content

Fix self-hosted editor: serve dist/ assets and default COLLAB_EMBEDDED_WS#40

Closed
michael-ford wants to merge 1 commit intoEveryInc:mainfrom
michael-ford:fix/self-hosted-editor-loading
Closed

Fix self-hosted editor: serve dist/ assets and default COLLAB_EMBEDDED_WS#40
michael-ford wants to merge 1 commit intoEveryInc:mainfrom
michael-ford:fix/self-hosted-editor-loading

Conversation

@michael-ford
Copy link
Copy Markdown

Summary

Two issues prevent the editor from loading when running the Proof SDK locally:

  • Missing static middleware for dist/: The server reads dist/index.html for the SPA shell but never mounts express.static for the dist/ directory, so assets/editor.js returns 404 and the editor stays on "Loading editor..."
  • Wrong WebSocket port without COLLAB_EMBEDDED_WS: The resolveRequestScopedCollabWsBase function defaults to port+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: Add express.static(path.join(__dirname, '..', 'dist')) so built assets are served
  • .env.example: Add COLLAB_EMBEDDED_WS=1 so cp .env.example .env gives a working local setup

Test plan

  • npm run build && npm run serve → open http://localhost:4000/d/<slug>?token=<token> → editor loads with document content
  • Verify collab-session endpoint returns ws://localhost:4000/ws (not 4001)
  • Verify real-time edits sync between browser and agent bridge API

…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.
@michael-ford
Copy link
Copy Markdown
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.

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.

1 participant