tchiotludo / akhq

Kafka GUI for Apache Kafka to manage topics, topics data, consumers group, schema registry, connect and more...
https://akhq.io/
Apache License 2.0
3.37k stars 653 forks source link

Error displaying schemas in topics with different names [0.25.0] #1795

Closed omrazCZ closed 3 months ago

omrazCZ commented 4 months ago

Hi,

today we have upgraded to AKHQ 25.0.

Seems we are having trouble when clicking on the schema ID of a message when the schema has a different name than the topic. Nothing happens. For other schemas it works fine.

Note that in the 'Schema Registry' tab we can still view the schemas without problems.

Do you know what could be causing this?

shaneikennedy commented 4 months ago

This commit 29df54a864dcfdd7f70337c1ad7a9650a63da951 needs to get merged and for users to upgrade before we can start debugging this I think, right now we can't see the error that's being thrown by the backend here.

If you are running this as a container you can try deploying the :dev tagged image but otherwise we need to wait for a new version.

I had a quick look to see if this would be easy to repro and I did find something: is there any chance that the topic name doesn't match the name of the schema subject for your case?

omrazCZ commented 4 months ago

Hi, thanks for the reply @shaneikennedy ! Indeed you are right, non-matching schema subject & topic names are the problem.

I have also verified that if the names match, I can view the schemas correctly even if they contain imports. (it just happened to be the case for us that all these topics contain imports) I've updated the issue.

Regarding the :dev tag, this will be difficult due to the internal regulations in our company, but if a 0.25.1 version is released, I could try out your fix

shaneikennedy commented 4 months ago

The commit that introduced this limitation (subject and topic names must match in order for the redirect to work) is here https://github.com/tchiotludo/akhq/commit/883174478deea626aaab72c310a9677f7ac6ece0#diff-09a1f07f9fc86b5b7707d9b8e9ab0d53620d4423b0eb4401e4e52d2eae201062

I don't understand the need for that query parameter if we're looking up schema's by ID, i would think that ID's are unique and additional filtering wouldn't be necessary, the docs say this but maybe there's a caveat since kafkahq supports multiple tenants source

AlexisSouquiere commented 4 months ago

I will have a deeper look into it because I'm the author of this commit but there were 2 reasons for it:

  • Avoid iterating over all the registry searching for a subject that match the schema id
  • Prevent redirecting to the wrong subject details if several subjects are using the same schema (use the topic name to search for the right subject in the list of subjects with the same schemas)

Schema id is unique yes but a same schema can refer to several subjects. And in the previous version you could have been redirected to the wrong subject by using only the schema ID. So in this case I gave the topic name to get the right subject following TopicNameStrategy. But I probably missed some edge cases like the one you are mentioning @omrazCZ

AlexisSouquiere commented 4 months ago

Fix is ready. I put details in the PR and in the code