Flows: job.getChildrenValues is not a function for sandboxed workers
Version 1.46.6
The below line works as documented for normal workers, but throws the error job.getChildrenValues is not a function for sandboxed processors.
const childrenValues = await job.getChildrenValues();
Below are code snippets used to test, sans imports for brevity. A nested job added to a FlowProducer:
await flowProducer.add({
name: "parent-job",
queueName: "parent",
children: [{
name: "child",
queueName: "child",
data: { colour: "red" },
}]
});
Processed by sandboxed worker processes:
const parentWorker = new Worker(
"parent",
path.join(__dirname, "../dist") + "/processor-parent.js",
);
const childWorker = new Worker(
"child",
path.join(__dirname, "../dist") + "/processor-child.js",
);
Processor definitions:
import { processorParent } from "./processors";
export default processorParent;
import { processorChild } from "./processors";
export default processorChild;
processors.ts:
export const processorParent = async(job: Job) => {
const childrenValues = await job.getChildrenValues();
console.log(childrenValues);
}
export const processorChild = async (job: Job) => {
return "Child Return Test Value"
}
Yes, we are missing some proxies for flow related methods in Flows. Thanks for reporting.
Current workout:
import { Job, Queue } from "bullmq"
export default async function(sandboxedJob) {
const queue = new Queue(sandboxedJob.queueName, { connection }) // pass the same connection settings
const job = await Job.fromId(queue, sandboxedJob.id)
const childrenValues = await job.getChildrenValues()
}
Any updates on this?
I am also looking for this to be resolved.
+1
An updates on this?
I just got bit by this thinking it was supported. Rewrote a large chunk of my app and ran into this issue. I should've checked it first with a small example 😞.
We have a PR for this, seems like it could be merged anytime now https://github.com/taskforcesh/bullmq/pull/1417
An update on this?
issue still here on v5.34.5
Added in v5.35.0: https://docs.bullmq.io/changelog#id-5.35.0-2025-01-22
@manast -- just wondering your thoughts on making the timeout adjustable when getting children values. We have some large flows with many child jobs with some fairly large return values.
While we haven't hit that timeout yet, just wondering if that ceiling could be adjustable if needed.
The easiest way would be to configure it via env variables.
If the call takes too long time thats not good in general. We may need to add pagination support to keep the calls very fast, as keeping Redis busy with one command for so long is not recommended.
I'm on latest bullmq (5.63.0), SandboxJob doest have getChildrenValues,
Is that expected?