Xabaril / AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package
Apache License 2.0
4.03k stars 787 forks source link

HealthChecks-UI Shows blank screen, error in console logged #2053

Open ShvetsovZE opened 10 months ago

ShvetsovZE commented 10 months ago

What happened: Setup HealthChecksUI in NET 7 project

What you expected to happen: View Healthcheck status through UI.

How to reproduce it (as minimally and precisely as possible): Navigate to the /health-ui/ page App then navigates to /health-ui#/healthchecks See API Call retrieve status from /healthz/ successfully. Check the error in the browser console image

Source code sample:

 app.UseEndpoints(
     endpoints =>
     {
         endpoints.MapHealthChecks("/health", new HealthCheckOptions
         {
             ResultStatusCodes =
             {
                 [HealthStatus.Healthy] = StatusCodes.Status200OK,
                 [HealthStatus.Degraded] = StatusCodes.Status200OK,
                 [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
             },
         });
         endpoints.MapHealthChecks("/healthz", new HealthCheckOptions
         {
             Predicate = _ => true,
             ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
         });
         endpoints.MapControllers();
     });
 app.UseResponseCaching();
 app.UseHealthChecksUI(config =>
 {
     config.UIPath = "/health-ui";
     config.ApiPath = "/healthz";
     config.AsideMenuOpened = false;
 });

Anything else we need to know?: it's a copy of https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/774, the difference is looks like my API paths are different for general health check call and for the UI. Response from /healthz could be found below

{
  "status": "Healthy",
  "totalDuration": "00:00:00.1139819",
  "entries": {
    "azure_cosmosdb": {
      "data": {

      },
      "duration": "00:00:00.1131929",
      "status": "Healthy",
      "tags": [

      ]
    }
  }
}

Environment:

sungam3r commented 8 months ago

Rel #1839