TypeError: Q.nextTick.runAfter is not a function
See original GitHub issuevar answer = q.defer();
var replyQueue;
function MaybeAnswer(msg) {
answer.reject(new Error(msg.content.toString()));
}
return ch.assertQueue(toQueue, queueOptions || this.queueOptions)
.then(function () {
return ch.assertQueue('', this.replyQueueOptions);
}.bind(this))
.then(function assertQueueSuccess(qok) {
replyQueue = qok.queue;
return ch.consume(replyQueue, MaybeAnswer.bind(this), {noAck: true});
}.bind(this))
.then(function consumeSuccess() {
ch.sendToQueue(toQueue || this.queue, new Buffer(msg), props);
return answer.promise;
}.bind(this))
.catch(function (error) {
// Return Error to the outer .catch()
this.logger.error(error);
return q.reject(error);
}.bind(this))
.finally(function () {
if (this.standalone) {
conn.close();
}
else {
ch.close();
}
}.bind(this));
While running above code I’m getting an error
TypeError: Q.nextTick.runAfter is not a function
stack trace: at trackRejection (/Volumes/DATA/projects/cirrent/api-dev/node_modules/q/q.js:1059:20) at reject (/Volumes/DATA/projects/cirrent/api-dev/node_modules/q/q.js:1133:5) at deferred.reject (/Volumes/DATA/projects/cirrent/api-dev/node_modules/q/q.js:634:16) at Object.MaybeAnswer (/Volumes/DATA/projects/cirrent/api-dev/node_modules/API-Common/helpers/rpc.js:98:44) at Channel.BaseChannel.dispatchMessage (/Volumes/DATA/projects/cirrent/api-dev/node_modules/amqplib/lib/channel.js:466:12) at Channel.BaseChannel.handleDelivery (/Volumes/DATA/projects/cirrent/api-dev/node_modules/amqplib/lib/channel.js:475:15) at emitOne (events.js:77:13) at Channel.emit (events.js:169:7) at /Volumes/DATA/projects/cirrent/api-dev/node_modules/amqplib/lib/channel.js:263:10 at Channel.content as handleMessage
I really couldn’t find out what’s gone wrong with my code. I’d appreciate if anyone can help with this.
Issue Analytics
- State:
- Created 8 years ago
- Comments:17 (5 by maintainers)
Top GitHub Comments
As the person who suggested the scheduler APi for bluebird I’ll gladly implement an API for Q for the same thing if Kris asks.
@zamb3zi , Attempting your workaround, runAfter comes back as undefined when destructuring nextTick after reassignment. I’m using q@1.4.1.