jwalton / node-amqp-connection-manager

Auto-reconnect and round robin support for amqplib.
520 stars 104 forks source link

node-amqp-connection-manager doesn't retry "Operation failed: QueueDeclare" error #368

Open IvanKodak opened 2 months ago

IvanKodak commented 2 months ago

I got a case when my RabbitMq was unavailable and after a few retries, the app was through an unhandled rejection error. I think that was caused because node-amqp-connection-manager doesn't handle this type of error from the amqplib.

I will attach the logs, that I have. Thanks in advance for helping.

Package versions:
amqp-connection-manager: 4.1.14
amqplib: 0.10.3
Stack:

Error: Operation failed: QueueDeclare; 404 (NOT-FOUND) with message "NOT_FOUND - failed to perform operation on queue '<queue-name>' in vhost 'dev' due to timeout"
    at reply (/usr/app/node_modules/amqplib/lib/channel.js:133:29)
    at ConfirmChannel.C.accept (/usr/app/node_modules/amqplib/lib/channel.js:416:7)
    at Connection.mainAccept (/usr/app/node_modules/amqplib/lib/connection.js:63:33)
    at TLSSocket.go (/usr/app/node_modules/amqplib/lib/connection.js:486:48)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket.emit (node:domain:488:12)
    at emitReadable_ (node:internal/streams/readable:832:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)

Trace:

{
  "file": "/usr/app/node_modules/amqplib/lib/channel.js",
  "line": 133,
  "column": 29,
  "native": false,
  "method": null,
  "function": "reply"
},
{
  "file": "/usr/app/node_modules/amqplib/lib/channel.js",
  "line": 416,
  "column": 7,
  "native": false,
  "method": "accept",
  "function": "ConfirmChannel.C.accept"
},
{
  "file": "/usr/app/node_modules/amqplib/lib/connection.js",
  "line": 63,
  "column": 33,
  "native": false,
  "method": "mainAccept",
  "function": "Connection.mainAccept"
},
{
  "file": "/usr/app/node_modules/amqplib/lib/connection.js",
  "line": 486,
  "column": 48,
  "native": false,
  "method": "go",
  "function": "TLSSocket.go"
},
{
  "file": "node:events",
  "line": 518,
  "column": 28,
  "native": false,
  "method": "emit",
  "function": "TLSSocket.emit"
},
{
  "file": "node:domain",
  "line": 488,
  "column": 12,
  "native": false,
  "method": "emit",
  "function": "TLSSocket.emit"
},
{
  "file": "node:internal/streams/readable",
  "line": 832,
  "column": 12,
  "native": false,
  "method": null,
  "function": "emitReadable_"
},
{
  "file": "node:internal/process/task_queues",
  "line": 81,
  "column": 21,
  "native": false,
  "method": null,
  "function": "processTicksAndRejections"
}
DmytroShalaiev commented 2 months ago

Maybe someone can help with an issue, should such errors be handled & processed by node-amqp-connection-manager?