Skip to content

[Bug]: RangeError when adding child job #2820

Closed
@jonknyc

Description

@jonknyc

Version

^5.18.0

Platform

NodeJS

What happened?

When adding a child job (following the steps documented here: https://docs.bullmq.io/patterns/process-step-jobs#waiting-children), I get an error:

RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: "length" is outside of buffer bounds
    at proto.utf8Write (node:internal/buffer:1066:13)
    at Packr.encodeUtf8 (/Users/jonk/celebrate2/node_modules/msgpackr/pack.js:31:18)
    at pack (/Users/jonk/celebrate2/node_modules/msgpackr/pack.js:324:15)
    at packArray (/Users/jonk/celebrate2/node_modules/msgpackr/pack.js:238:5)
    at pack (/Users/jonk/celebrate2/node_modules/msgpackr/pack.js:424:7)
    at Packr.pack.encode (/Users/jonk/celebrate2/node_modules/msgpackr/pack.js:129:6)
    at Scripts.addStandardJob (/Users/jonk/celebrate2/node_modules/bullmq/src/classes/scripts.ts:158:15)
    at Scripts.addJob (/Users/jonk/celebrate2/node_modules/bullmq/src/classes/scripts.ts:219:27)
    at Job.addJob (/Users/jonk/celebrate2/node_modules/bullmq/src/classes/job.ts:1212:25)
    at Function.create (/Users/jonk/celebrate2/node_modules/bullmq/src/classes/job.ts:254:24) {
  code: 'ERR_BUFFER_OUT_OF_BOUNDS'
}

If I add the job without specifying the parent details, it works. But when I specify the parent, it fails:

            // create child job
            await queue.add(JobType.FOO, data, {
              parent: {
                id: job.id!,
                queue: job.queueQualifiedName,
              },
            })

I have confirmed that the job ID exists and everything looks correct. As I said, I am basically copying the documentation.

How to reproduce.

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions