doujiang24 / lua-resty-kafka

Lua kafka client driver for the Openresty based on the cosocket API
BSD 3-Clause "New" or "Revised" License
801 stars 274 forks source link

Producer cannot send with Confluent Cloud due to SASL error #114

Closed samcrawford closed 2 years ago

samcrawford commented 2 years ago

I've been trying to get this library working with Confluent Cloud, which makes use of SASL_SSL auth. I found that I could retrieve the list of topics and partitions, but any sending would result in err: closed after a delay.

After some debugging, I found that the sasl_config was not being propagated to the downstream requests to the brokers obtained in the fetch_metadata function. I modified the code to inject sasl_config and then everything works.

My modified code is at https://github.com/samcrawford/lua-resty-kafka/commit/39e6e31040c801369fcb206ce7cb0bd600c38527

I don't know if this is some special requirement from Confluent Cloud, or if this is a genuine bug. Either way, I'm posting here in case it helps someone else struggling with this.

doujiang24 commented 2 years ago

@samcrawford seems you are right, could you please create a PR for this fix, thanks.

samcrawford commented 2 years ago

Thanks. Raised https://github.com/doujiang24/lua-resty-kafka/pull/115. And thanks for creating such a good library!

samcrawford commented 2 years ago

115 has been merged, closing this issue now. Thanks @doujiang24 !