Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JacksonFraser opened this issue May 6, 2024 · 2 comments · Fixed by #1088

Comments

@JacksonFraser
Copy link

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

@JacksonFraser
Copy link
Author

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

@tmellanxt
Copy link
Contributor

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

@sdelamo sdelamo transferred this issue from micronaut-projects/micronaut-core May 8, 2024
tmellanxt added a commit to tmellanxt/micronaut-kafka that referenced this issue Oct 18, 2024
tmellanxt added a commit to tmellanxt/micronaut-kafka that referenced this issue Oct 22, 2024
graemerocher pushed a commit that referenced this issue Oct 24, 2024
## Summary
This pull request addresses issue #1026 by implementing a custom `Serde<TaskId>` to kafka-streams module. This avoid a serialization error when calling the `/health` endpoint, which throws in turn a:
```
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.
```

## Changes Made
- Added serde processor as `annotationProcessor`, and serde api as `compileOnly` to load in the annotation. 
- Created a class dedicated to adding annotation for external classes that need serialising as part of the health result

## Related Issues
- Fixes #1026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants