Description
The /health endpoint returns an anonymous type that is not registered in the source-generated JSON serializer context (SkillServer.Models.SkillServerJsonContext), causing every health check request to throw System.NotSupportedException.
Error
System.NotSupportedException: JsonTypeInfo metadata for type '<>f__AnonymousType13`2[System.String,System.DateTimeOffset]' was not provided by TypeInfoResolver of type '[Microsoft.AspNetCore.OpenApi.OpenApiJsonSchemaContext, SkillServer.Models.SkillServerJsonContext]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
at Microsoft.AspNetCore.Http.HttpResultsHelper.WriteResultAsJsonAsync[TValue](...)
Impact
- Kubernetes HTTP liveness/readiness probes targeting
/health cause the pod to crash-loop
- Workaround: use
tcpSocket probes instead of httpGet probes
Reproduction
curl http://skillserver:8080/health
Suggested Fix
Replace the anonymous type in the health endpoint response with a named type registered in SkillServerJsonContext, or add Results.Ok("Healthy") as a plain string response.
Environment
- Image:
ghcr.io/netclaw-dev/skillserver:0.1.0
- Runtime: Kubernetes (MicroK8s 1.32)
Description
The
/healthendpoint returns an anonymous type that is not registered in the source-generated JSON serializer context (SkillServer.Models.SkillServerJsonContext), causing every health check request to throwSystem.NotSupportedException.Error
Impact
/healthcause the pod to crash-looptcpSocketprobes instead ofhttpGetprobesReproduction
Suggested Fix
Replace the anonymous type in the health endpoint response with a named type registered in
SkillServerJsonContext, or addResults.Ok("Healthy")as a plain string response.Environment
ghcr.io/netclaw-dev/skillserver:0.1.0