Skip to content

fix(ui): bundle Monaco workers into production build - #6627

Open
ajuijas wants to merge 1 commit into
keephq:mainfrom
ajuijas:fix/6580-monaco-workers-docker
Open

fix(ui): bundle Monaco workers into production build#6627
ajuijas wants to merge 1 commit into
keephq:mainfrom
ajuijas:fix/6580-monaco-workers-docker

Conversation

@ajuijas

@ajuijas ajuijas commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the Could not create web worker(s)... You must define MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker error in the production Docker image, where the CEL editor falls back to synchronous mode because no Monaco worker files exist anywhere in the image.

Fixes #6580

Why

Two things were missing in production:

  1. scripts/build-monaco-workers-turbopack.js (which bundles the workers into public/monaco-workers/) was only wired into the dev script, so production builds never emitted the worker files — docker/Dockerfile.ui copies public/ into the image, but the directory was never populated.
  2. The webpack/production CEL editor variant (MonacoCel.tsx) never set MonacoEnvironment, so even with workers present Monaco wouldn't know where to load them from. (The dev/turbopack variants already handle this.)

How

  • package.json: build now runs npm run build-monaco-workers && ./next_build.sh, mirroring the existing dev script.
  • MonacoCel.tsx: sets self.MonacoEnvironment.getWorkerUrl to the pre-built /monaco-workers/{json,yaml,editor}.worker.js files, matching the exact filenames the build script emits (webpack entries {editor,json,yaml}.worker with filename: "[name].js").

This is the same approach the issue thread converged on.

How it was tested

  • Ran npm run build-monaco-workers locally: webpack compiled successfully and emitted editor.worker.js, json.worker.js, yaml.worker.js into keep-ui/public/monaco-workers/ — confirming the getWorkerUrl paths match the real output filenames.
  • Not tested: a full npm run build / Docker image build was not run locally. The wiring mirrors the existing dev script, and Dockerfile.ui already copies public/ into the runner stage, but I'd appreciate a maintainer sanity-check of the production image.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. Bug Something isn't working UI User interface related issues labels Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files. UI User interface related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Monaco workers are not found in the production Docker image

1 participant