1
我正在使用bluebird 2.x.TypeError:無法設置未定義的屬性'_bitField'(藍鳥庫)
我打電話給包裹在諾言中的卡夫卡。如果消息已發佈,則承諾將被解決。如果對卡夫卡的呼叫失敗,該promis將被拒絕。
這裏是一塊導致該錯誤代碼 -
redis.get(something)
.then(function() {
return Promise(function(resolve, reject) { // This is Line 98 in the stacktrace
producer.send([
{
topic : "Ganga",
messages : [JSON.stringify({// some object})]
}
], function(err, data) {
if(err) {
logger.error("Error")
logger.error(err);
reject(err);
return;
}
resolve(data);
})
});
})
堆棧跟蹤如下:
TypeError: Cannot set property '_bitField' of undefined
at <project base path>/index.js:98:20
at bound (domain.js:280:14)
at runBound (domain.js:293:12)
at runCallback (timers.js:649:20)
at tryOnImmediate (timers.js:622:5)
at processImmediate [as _immediateCallback] (timers.js:594:5)
From previous event:
at Server.<anonymous> (<project base path>/index.js:97:10)
at next (<project base path>/node_modules/restify/lib/server.js:912:30)
at f (<project base path>/node_modules/once/once.js:25:25)
at Server.parseBody (<project base path>/node_modules/restify/lib/plugins/body_parser.js:94:13)
at next (<project base path>/node_modules/restify/lib/server.js:912:30)
at f (<project base path>/node_modules/once/once.js:25:25)
at IncomingMessage.done (<project base path>/node_modules/restify/lib/plugins/body_reader.js:121:13)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
什麼可能是錯的任何建議?
什麼是'producer.send'?請在bluebird repo上打開一個問題 –
你在'Promise'之前缺少'new',但這不是我期望你得到的錯誤。 –
在Promise之前使用新的。上週我面臨同樣的錯誤。 –