-
Type:
Story
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Developer Tools
In local dev (npm start), opening the Compass shell fails with:
`mongodb-compass:compass-shell could not evaluate mongosh version
{ s: 'E', ctx: 'shell', error: 'Worker thread failed to start with error: undefined' }`
Packaged builds are fine, because they load the page from file://, which works on every Electron version tested.
Root cause
- In dev, the window loads from http://localhost:4242, but `@mongosh/node-runtime-worker-thread` starts its worker from a file:// URL: new Worker(pathToFileURL(workerProcessPath).href). That's a cross-origin worker, and Chromium refuses it even with webSecurity: false.
- COMPASS-8269 worked around this with a dev-only file: protocol handler in packages/compass/src/setup-hadron-distribution.ts:87, which re-fetches the request with net.fetch(req, { bypassCustomProtocolHandlers: true }).
- From Electron 42 on, that handler is never called for the worker request. The load is blocked before it reaches Electron's protocol handlers. The page then gets a plain Event of type error (not an ErrorEvent), so mongosh reports the message as undefined.