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

Microservice health indicator does not throw an error when RMQ connection is down #1891

Closed
2 of 4 tasks
BrunnerLivio opened this issue Jul 5, 2022 · 2 comments
Closed
2 of 4 tasks

Comments

@BrunnerLivio
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

In case the RMQ connection is down, the health indicator will be displayed as "down" but the health check is still healthy.

Minimum reproduction code

Given the following health check:

return this.health.check([
      () =>
        this.disk.checkStorage('disk', { path: '/', thresholdPercent: 0.5 }),
      () =>
        this.microservice.pingCheck('tcp', {
          transport: Transport.RMQ,
          options: {
            urls: ['amqp://localhost:5672'],
            queue: 'cats_queue',
            queueOptions: {
              durable: false,
            },
          },
        }),
    ]);

In case RMQ is down the health check will still be seen as healthy.

Steps to reproduce

No response

Expected behavior

It should be unhealthy

Package version

8.1.0

NestJS version

8.x.x

Node.js version

16.x.x

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@BrunnerLivio
Copy link
Member Author

Can be fixed by adding the following lines to the catch-clause of MicroserviceHealthIndicator.pingCheck.

throw new HealthCheckError(
                    err,
                    this.getStatus(key, false, { message: err }),
}

@ronan-f
Copy link

ronan-f commented Jul 5, 2022

@BrunnerLivio Are you planning to implement this fix? If not let me know and I can put up a PR with your suggested change.

@ronan-f ronan-f mentioned this issue Jul 5, 2022
12 tasks
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