Skip to content

fix(worker): resolve processor path as URL for Windows ESM compatibility#171

Open
bbornino wants to merge 1 commit into
playfulprogramming:mainfrom
bbornino:fix/worker-windows-esm-path
Open

fix(worker): resolve processor path as URL for Windows ESM compatibility#171
bbornino wants to merge 1 commit into
playfulprogramming:mainfrom
bbornino:fix/worker-windows-esm-path

Conversation

@bbornino

Copy link
Copy Markdown
Contributor

What broke

On Windows, createWorker failed to resolve task processor files. import.meta.resolve(processor) returns a file:// URL, and the old code stripped the scheme with a plain string replace (.replace(/^file:\/\//, "")). On Windows that leaves a path like /C:/projects/.../processor.ts — a leading slash in front of the drive letter — which BullMQ/Node can't open as a filesystem path. The same code works fine on POSIX systems, which is why it went unnoticed until running the worker on Windows.

Fix

Wrap the resolved URL in new URL(...) instead of manually stripping the scheme, and pass that to Worker. BullMQ/Node accept a URL object directly and handle the platform-specific path conversion correctly, so this works on both Windows and POSIX.

Related improvement

Also adds a worker.on("stalled", ...) handler that logs a warning when a job stalls. This isn't part of the Windows fix itself, but came out of the same investigation into worker behavior and is small enough to include here rather than open a separate PR.

Fixes #170

import.meta.resolve() returns a file:// URL whose path is not directly
usable as a filesystem path on Windows (drive-letter prefix breaks the
plain string replace). Wrap it in a URL instead of stripping the scheme
manually so BullMQ resolves the processor correctly on all platforms.

Also logs a warning when a job stalls, surfaced during the same
investigation.
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bbornino, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 47 minutes and 34 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f07ad0fc-f420-42a3-a956-ff138afba3f3

📥 Commits

Reviewing files that changed from the base of the PR and between 5a4aaf2 and 9982c60.

📒 Files selected for processing (1)
  • apps/worker/src/createWorker.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

fix: createWorker.ts fails to load processors on Windows due to ESM URL handling

1 participant