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

[Bug]: DelayError throwing in Child Processor breaks without Message #2962

Closed
1 task done
jpulec opened this issue Dec 10, 2024 · 0 comments · Fixed by #2967
Closed
1 task done

[Bug]: DelayError throwing in Child Processor breaks without Message #2962

jpulec opened this issue Dec 10, 2024 · 0 comments · Fixed by #2967
Labels
bug Something isn't working

Comments

@jpulec
Copy link

jpulec commented Dec 10, 2024

Version

v5.29.1

Platform

NodeJS

What happened?

Description

Throwing DelayedError doesn't work properly with child processor sandboxing, if you don't pass a message to the thrown error. This appears to be because when sending a message to the parent that a child failed, it checks if there's an err.message property, and if not, wraps the error with new Error(err) which causes the name property to be overwritten as Error so that the checks for err.name === 'DelayedError in the Worker class are incorrect.

How to reproduce.

// worker.js
import { pathToFileURL } from 'url';

const processorUrl = pathToFileURL(__dirname + '/my_processor.js');

worker = new Worker(queueName, processorUrl);
// my_processor.js
import { SandboxedJob } from 'bullmq';

module.exports = async (job: SandboxedJob) => {
   // Note the absense of a passed in message here
    throw new DelayedError();
};

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jpulec jpulec added the bug Something isn't working label Dec 10, 2024
github-actions bot pushed a commit that referenced this issue Dec 18, 2024
## [5.34.3](v5.34.2...v5.34.3) (2024-12-18)

### Bug Fixes

* **sandboxed:** fix detecting special errors by sending default messages ([#2967](#2967)) fixes [#2962](#2962) ([52b0e34](52b0e34))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant