Jobs are undefined in the queue
Created by: akirilyuk
Description
Hi, we started noticing errors in our production environment. Unfortunately this is the only piece of information I can share with you:
TypeError: client.isJobInList is not a function at Object.isJobInList (/app/node_modules/bull/lib/scripts.js:11:19) at Job._isInList (/app/node_modules/bull/lib/job.js:511:18) at Job.isActive (/app/node_modules/bull/lib/job.js:350:15) at result.then.state (/app/node_modules/bull/lib/job.js:383:27) at process._tickCallback (internal/process/next_tick.js:68:7)
Also we noticed that some jobs in the queue are becoming an empty object.
Minimal code to reproduce
const jobs = await queue.getJobs();
try {
const jobsWithState = await Promise.all(
jobs.map(async job => {
try {
const jobState = await job.getState();
return { ...job, jobState };
} catch (err) {
// this is thrown al the time, however the jobId is undefined
warn('bull:getJobMetrics: Could not get Job State', {
jobId: job.jobId
});
return { ...job, jobState: undefined };
}
})
);
} catch (err) {
// this is not thrown
error('bull:getJobMetrics:', {
errorMessage: err.message,
errorTrace: err.stack
});
return null;
}
Bull version
3.10.0