TypeError: Cannot read property 'message' of undefined in Job#moveToFailed
Created by: papandreou
(carried over from https://github.com/OptimalBits/bull/pull/2027)
We've seen this error show up in production a couple of times:
TypeError: Cannot read property 'message' of undefined
File "/app/node_modules/bull/lib/job.js", line 273, in Job.moveToFailed
this.failedReason = err.message;
File "/app/node_modules/bull/lib/queue.js", line 1084, in handleFailed
return job.moveToFailed(err).then(jobData => {
File "<anonymous>", line unknown, in runMicrotasks
File "internal/process/task_queues.js", line 93, in processTicksAndRejections
It seems to happen while the server instance is shutting down or after an uncaught exception, so maybe there's a method somewhere (or ioredis) that's returning a promise that gets rejected with undefined
.
I haven't been able to recreate the specific circumstances locally, but maybe you have an idea