nestjs / terminus

Terminus module for Nest framework (node.js) :robot:
https://nestjs.com/
MIT License
671 stars 101 forks source link

nest10 health check return Service Unavailable Exception #2436

Closed warriorBrian closed 10 months ago

warriorBrian commented 10 months ago

Is there an existing issue for this?

Current behavior

I wrote a health check demo using nestjs10, but it returned that the service was unavailable at startup.

error:

ServiceUnavailableException: Service Unavailable Exception
    at HealthCheckService.<anonymous> (/Users/demo/node_modules/@nestjs/terminus/lib/health-check/health-check.service.ts:62:11)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/demo/node_modules/@nestjs/terminus/dist/health-check/health-check.service.js:17:58)

Minimum reproduction code

import { Injectable } from '@nestjs/common';
import { HealthCheckService, HttpHealthIndicator, HealthCheck, DiskHealthIndicator } from '@nestjs/terminus';
@Injectable()
export class HealthService {
    constructor (
        private health: HealthCheckService,
        private http: HttpHealthIndicator,
        private readonly disk: DiskHealthIndicator,
    ) {}

    @HealthCheck()
    public async start () {
        return this.health.check([
            () => this.http.pingCheck('nestjs-docs', 'https://docs.nestjs.com')
        ]);
    }

}

Steps to reproduce

No response

Expected behavior

I did not have this problem when I used nestjs9 to download 9.2.2, but this problem occurred when I used nestjs10 to download @nestjs/terminus@10.0.0 or 10.1.1

Package version

10.1.1

NestJS version

10.0.0

Node.js version

18.17.1

In which operating systems have you tested?

Other

No response

warriorBrian commented 10 months ago
image

I printed the results in node_modules, status did not return ok but returned shutting_down.

@BrunnerLivio