micronaut-projects/micronaut-kafka

Kafka Streams and Jackson Serialization results in CodecException when calling Health endpoint

Opened this issue · 2 comments

Expected Behavior

The health endpoint returns health status and health details

Actual Behaviour

An exception: Unexpected error occurred: Error encoding object [io.micronaut.management.health.indicator.DefaultHealthResult@69164ed1] to JSON: No serializable introspection present for type TaskId. Consider adding Serdeable. Serializable annotate to type TaskId. Alternatively if you are not in control of the project's source code, you can use @SerdeImport(TaskId.class) to enable serialization of this type. io.micronaut.http.codec.CodecException: Error encoding object [io.micronaut.management.health.indicator.DefaultHealthResult@69164ed1] to JSON: No serializable introspection present for type TaskId. Consider adding Serdeable. Serializable annotate to type TaskId. Alternatively if you are not in control of the project's source code, you can use @SerdeImport(TaskId.class) to enable serialization of this type.

Steps To Reproduce

  1. Run git clone git@github.com:JacksonFraser/health-demo.git && cd health-demo && ./gradlew run
  2. Open new terminal window
  3. Run curl http://localhost:8081/health

Environment Information

  • Operating System: Ubuntu 22.04.4 LTS
  • JDK: openjdk 17.0.7 2023-04-18 LTS

Example Application

https://github.com/JacksonFraser/health-demo

Version

4.0.4

The workaround of adding @SerdeImport(TaskId.class) resolves the issue. However, I believe this needs to be fixed regardless

We are facing the same issue, we face the issue when upgrading io.micronaut.kafka:micronaut-kafka to the latest version (5.4.0). Version 4.5.5 seems not include the bug.

Not sure where the bug originates from but perhaps the bug would be best reported in the kafka project: https://github.com/micronaut-projects/micronaut-kafka/issues