symfony-health-check-bundle icon indicating copy to clipboard operation
symfony-health-check-bundle copied to clipboard

Redis DSN configuration error when Redis is not used

Open Kuppit opened this issue 2 weeks ago • 0 comments

Describe the bug Since version 1.6.0, symfony-health-check-bundle has added a test on Redis. When Redis is not configured (i.e., no DSN is provided), the container fails to compile because the RedisCheck service receives null instead of a string. This leads to an error in the linter.

To Reproduce

  1. Install symfony-health-check-bundle version 1.6.0 or later.
  2. Do not configure Redis (i.e., do not define a DSN for Redis).
  3. Run a container lint check (e.g., using "docker compose exec php symfony lint:container").
  4. Observe the error indicating that null was passed where a string was expected by RedisCheck::__construct().

Expected behavior The bundle should either not register the RedisCheck service when Redis is not being used, or it should handle a missing DSN gracefully, so that the container compiles without errors.

Screenshots Image

My config

symfony_health_check:
    health_checks:
        - id: Surface\Core\Health\Check\GotenbergCheck
        - id: Surface\Core\Health\Check\PostgresqlCheck
    health_error_response_code: 500

Kuppit avatar Feb 13 '25 10:02 Kuppit