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]: FlowProducer#getFlow() returns undefined children when colon characters are used in queue names #2718

Closed
1 task done

Comments

@brncsk
Copy link

brncsk commented Aug 21, 2024

Version

v5.12.9

Platform

NodeJS

What happened?

FlowProducer#getFlow() returns an array of undefined children when descendant jobs passed to FlowProducer#add() have queueNames containing colon (:) characters.

How to reproduce.

import { FlowProducer } from 'bullmq';

const flow = new FlowProducer();

const { job } = await flow.add({
  name: 'parent',
  queueName: 'parent',
  children: [{ name: 'child', queueName: 'parent:child' }]
});

const { children } = await flow.getFlow({
  id: job.id,
  queueName: 'parent'
});

console.log(children); // → [undefined]

It's probably this line:

const [prefix, queueName, id] = key.split(':');

...that's causing the problem.

Splitting/joining by : happens in a lot of places so it'd be nice to issue a warning if the user happens to choose a queue name or other identifier that contains a colon and might end up in those places to beware of the consequences.

Somewhat similar/related: #1334

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@brncsk brncsk added the bug Something isn't working label Aug 21, 2024
@roggervalf roggervalf added better docs and removed bug Something isn't working labels Aug 22, 2024
github-actions bot pushed a commit that referenced this issue Aug 29, 2024
## [5.12.12](v5.12.11...v5.12.12) (2024-08-29)

### Bug Fixes

* **flows:** throw error when queueName contains colon ([#2719](#2719)) fixes [#2718](#2718) ([9ef97c3](9ef97c3))
@brncsk
Copy link
Author

brncsk commented Aug 30, 2024

Thanks for the rapid fix, folks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment