Queue.process("path/to/module") doesn't handle ES6 default export
Created by: develar
/app/node_modules/bluebird/js/release/method.js:9
throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
^
TypeError: expecting a function but got [object Object]
at Function.Promise.method (/app/node_modules/bluebird/js/release/method.js:9:15)
at process.<anonymous> (/app/node_modules/bull/lib/process/master.js:35:29)
at emitTwo (events.js:126:13)
at process.emit (events.js:214:7)
at emit (internal/child_process.js:772:12)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Problem is that typescript produces ES6 default export:
Object.defineProperty(exports, "__esModule", { value: true })
exports.default = processor;
So, Bull should not expect that exports
will be function
, but instead use default
if defined.
Workaround: give some name to default function and
module.exports = processor