Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestJS doesn't handle "Operation failed: QueueDeclare" error from amqplib #13462

Open
3 of 15 tasks
IvanKodak opened this issue Apr 18, 2024 · 1 comment
Open
3 of 15 tasks

Comments

@IvanKodak
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I got a case when my RabbitMq was unavailable and after a few retries, NestJs was through an unhandled rejection error.
I think that was caused because @nestjs/microservices doesn't handle this type of error from the amqplib.

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

Minimum reproduction code

Currently I haven't reproduced this issue on local machine

Steps to reproduce

No response

Expected behavior

NestJS handles this error and tries to retry to connect to RabbitMq

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

10.3.4

Packages versions

[Nest Platform Information]
platform-express version : 10.3.4
cache-manager version    : 2.2.1
event-emitter version    : 2.0.4
microservices version    : 10.3.4
sequelize version        : 10.0.1
schedule version         : 4.0.1
testing version          : 10.3.4
common version           : 10.3.4
config version           : 3.2.0
axios version            : 3.0.2
core version             : 10.3.4
cli version              : 10.3.2

Node.js version

20.11.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

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"
}
@IvanKodak IvanKodak added the needs triage This issue has not been looked into label Apr 18, 2024
@IvanKodak IvanKodak changed the title NestJS doesn't handle NOT_FOUND error from amqplib NestJS doesn't handle "Operation failed: QueueDeclare" error from amqplib Apr 18, 2024
@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

@kamilmysliwiec kamilmysliwiec added needs clarification and removed needs triage This issue has not been looked into labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants