rabbot
rabbot copied to clipboard
unhandledRejection upon network issues
"rabbot": "^2.1.0"
Developing locally, I see the following error when my MacBook goes into sleep:
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
Error: Operation failed: ExchangeBind; 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'std-jobs-q' in vhost 'XXX'"
at reply (/myPath/node_modules/amqplib/lib/channel.js:127:17)
at Channel.C.accept (/myPath/node_modules/amqplib/lib/channel.js:401:7)
at Connection.mainAccept [as accept] (/myPath/node_modules/amqplib/lib/connection.js:64:33)
at Socket.go (/myPath/node_modules/amqplib/lib/connection.js:477:48)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at emitReadable_ (_stream_readable.js:513:10)
at emitReadable (_stream_readable.js:507:7)
at addChunk (_stream_readable.js:274:7)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
My code looks like this:
//...
rabbit
.configure(config)
.then(function() {
info('RabbitMQ config successful');
})
.catch(function(err) {
error('rabbit-configure: Could not connect to Q');
});
// For debugging this
rabbit.on('closed', function() {
error('rabbit-configure: closed');
rabbit.retry();
});
rabbit.on('failed', function() {
error('rabbit-configure: failed');
rabbit.retry();
});
rabbit.on('unreachable', function() {
error('rabbit-configure: unreachable');
rabbit.retry();
});
//...
When the failure happens the error msgs on catch and on the the closed, etc. events are not printed.
The rejection not being handled seems to be in amqplib, not in rabbot originally. Questions:
- Am I doing something wrong?
- If not, can rabbot catch those?
- If not, shall I raise this issue at amqplib?
I'm getting same in production. After that, consumer stopped working. Any ideas?
I'm having this issue in production too