Closed vikramindian closed 3 years ago
Try registering an error callback with the client and check for authorization errors. I included a link to one of the tests as an example.
errors https://docs.confluent.io/current/clients/confluent-kafka-python/#kafkaerror
Thank you for thee response @rnpridgeon
registered error callback but it did not get any error
You will need to call poll(), flush() or consume() to trigger the callbacks
@edenhill I'm calling poll() after every sending every message
Authorization is handled by the broker itself and not the client so I can't speak to the asymmetric handling of the metadata request between consumer and producer. I suspect user vikram has DESCRIBE
on topic-33
in addition to read in the consumer test. Either that or READ
on TOPIC
provides implicit access to DESCRIBE
. If the latter is true you'll want to take that up with the Kafka project itself.
https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/KafkaApis.scala#L1091
With that said I would expect to see a global error propagation of the authorization error. A delivery report error does feel more appropriate though I agree. In your produce example. I'll try to reproduce this inhouse. I'll follow up with my findings afterwards.
I did not provide describe permissions for user vikram on topic-33 explicitly.
I am also facing the same issue https://github.com/confluentinc/confluent-kafka-python/issues/704. Can somebody please help?
Any news? Does someone find solution how handle AuthorizationException when principal don't have ACL permissions to topic?
@azhurbilo What client version are you on? Are you using producer or consumer?
@edenhill producer / confluent-kafka 1.5.0
If it helps, I noticed that if you don't have the "Create TOPIC" permissions, it'll just hang. FYI, my auto.create.topics.enable
setting is on. Even if you add a timeout to flush, it'll act as if no error happened.
After I added that permission (but still don't have "Write TOPIC"), I do receive callback errors saying "Failed to deliver message" as expected.
Please repro on v1.6.0 when it is out
Description
There is a topic in secured kafka cluster on which I don't have write and read permissions. I started a producer and a consumer on this topic. My producer did not send any messages and even did not get any thing in delivery callback.
In debug logs, I could see 'Broker: Topic authorization failed' messages
Later I repeated same thing after I got only Read permissions on that topic. This time the observed debug messages were different and I got 'Topic authorization failed' message in delivery call back this time.
What did I figure out from this? In first case since I did not have Read permissions, producer failed to even fetch Topic Metadata and so it did not proceed further. Hence there are no produce requests and nothing in callbacks.
In second case, I have only Read permissions, so my producer fetched topic metadata and sent produce request but got error response and so I received this in my delivery callback.
Question
How to reproduce
Checklist
Please provide the following information:
confluent_kafka.version()
andconfluent_kafka.libversion()
):{...}
'debug': '..'
as necessary)