Skip to content

Health check API doesn't return health indicator result when data have status property #2668

@Coalery

Description

@Coalery

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

In @nestjs/terminus version 11.0.0, when calling either HealthIndicatorResult.up() or HealthIndicatorResult.down() with a data object that includes a status key, the corresponding health indicator is not included in the final response of the health check API.

Minimum reproduction code

Check this repository: https://github.com/Coalery/nestjs-terminus-bug-reproduce

Steps to reproduce

No response

Expected behavior

Health indicators that return a status field in their data should still be included in the final response.
If status is a reserved keyword, I think it should either:

  1. Be handled separately from user's data, or
  2. Be validated to only accept 'up' | 'down', or
  3. Be disallowed from being set in user data, with clear documentation or runtime validation

This behavior was not present in v10 and appears in v11.

Package version

11.0.0

NestJS version

11.1.5

Node.js version

20.12.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions