Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandboxed processors fails in NodeJS ECMA module #1534

Closed
eugeneroz opened this issue Nov 15, 2022 · 3 comments
Closed

Sandboxed processors fails in NodeJS ECMA module #1534

eugeneroz opened this issue Nov 15, 2022 · 3 comments
Labels
wontfix This will not be worked on

Comments

@eugeneroz
Copy link

Environment
NodeJS: 19
BullMQ: 3.2.1
Description
NodeJS module which built with ES6 (Put: "type" : "module" inside package.json) and run sandboxed version of Worker failed with the following error. The regular worker works as expected.
Example
const worker = new Worker("longJob", "longJob.js", { connection })
Error

Error: require() of ES Module /app/src/jobs/sandboxed/longJob.js from /app/node_modules/bullmq/dist/cjs/classes/child-processor.js not supported.\nInstead change the require of generateScanJob.js in /app/node_modules/bullmq/dist/cjs/classes/child-processor.js to a dynamic import() which is available in all CommonJS modules.
Issue

  1. child-processor.js should be used in esm package of bullmq
  2. Line 25 inside file child-processor.js: processor = require(processorFile) is not valid in ES6
@manast
Copy link
Contributor

manast commented Nov 15, 2022

Unfortunately, we cannot change the current implementation because even though it will fix this case it will break others, as this has been tried several times before and always resulted in broken deploys for other users. I do not see this as a bug in BullMQ, but unless proven the contrary a design flaw in the current NodeJS ecosystem.

@manast manast closed this as completed Nov 15, 2022
@manast manast added the wontfix This will not be worked on label Nov 15, 2022
@amadeogallardo
Copy link

Is this still the current standing? Considering:

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

@manast
Copy link
Contributor

manast commented Aug 15, 2023

I am putting my hopes on this https://bun.sh/1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants