LearnNewsExamplesServices
Frontmatter
id8865
titleFix Manager runtime errors in dist/prod (promises init & getWorker check)
stateClosed
labels
bugaicore
assigneestobiu
createdAtJan 22, 2026, 12:16 PM
updatedAtJan 22, 2026, 12:37 PM
githubUrlhttps://github.com/neomjs/neo/issues/8865
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 22, 2026, 12:37 PM

Fix Manager runtime errors in dist/prod (promises init & getWorker check)

Closed v11.23.1 bugaicore
tobiu
tobiu commented on Jan 22, 2026, 12:16 PM

The dist/production build of Portal App throws two errors on the Main Thread:

  1. Cannot set properties of undefined (setting 'neo-5') in promiseMessage.

    • Cause: me.promises appears to be undefined when checkServiceWorkerVersion is called during construct. Even though it is assigned in construct, the Native ESM build output may be affecting execution order or scope in unexpected ways.
    • Fix: Convert promises to a class field. This guarantees it is initialized immediately upon instantiation, well before construct() is called.
  2. Cannot read properties of undefined (reading 'worker') in getWorker.

    • Cause: getWorker attempts to access this.workers[name].worker without verifying if this.workers[name] exists.
    • Fix: Add a safety check: if (this.workers[name]) ....

Tasks:

  1. Update src/worker/Manager.mjs:
    • Define promises = {} as a class field.
    • Remove me.promises = {} from construct.
    • Update getWorker to safely check for this.workers[name].
  2. Verify the changes.
tobiu added the bug label on Jan 22, 2026, 12:16 PM
tobiu added the ai label on Jan 22, 2026, 12:16 PM
tobiu added the core label on Jan 22, 2026, 12:16 PM
tobiu referenced in commit b347f39 - "fix: Manager initialization order for Native ESM builds (#8865)" on Jan 22, 2026, 12:36 PM
tobiu
tobiu Jan 22, 2026, 12:36 PM

Input from Gemini 3 Pro:

✦ I have applied the fix for the runtime errors in dist/production.

Changes:

  1. Manager Initialization: Moved me.promises = {} to the very top of construct() in src/worker/Manager.mjs. This guarantees it is initialized before any other logic runs, resolving the Cannot set properties of undefined error.
  2. GetWorker Safety: Added a safety check in getWorker() to prevent Cannot read properties of undefined when accessing worker instances.

Verification: The user verified the fix by enabling logs in dist/development (which mirrors the production environment logic) and confirming that the errors are resolved and promiseMessage calls are successful.

The changes have been committed and pushed to dev.

tobiu assigned to @tobiu on Jan 22, 2026, 12:36 PM
tobiu closed this issue on Jan 22, 2026, 12:37 PM