fix(worker): resolve processor path as URL for Windows ESM compatibility#171
fix(worker): resolve processor path as URL for Windows ESM compatibility#171bbornino wants to merge 1 commit into
Conversation
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.
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
What broke
On Windows,
createWorkerfailed to resolve task processor files.import.meta.resolve(processor)returns afile://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 toWorker. BullMQ/Node accept aURLobject 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