Search code examples
goapache-kafkabackendfranz-go

is SASL missing? Franz-go kafka authentication issue


I am getting these error messages

"re-updating metadata due to err: broker closed the connection immediately after a request was issued, which happens when SASL is required but not provided: is SASL missing?" "read from broker errored, killing connection after 0 successful responses (is SASL missing?)"

I am trying to add authentication. My code for that is:

auth := scram.Auth{
        User: "kafka_user",
        Pass: "kafka_pass",
    }
    
    cl, err := kgo.NewClient(
        kgo.SeedBrokers(seeds...),
        kgo.DialTLSConfig(tlsConfig),
        kgo.SASL(auth.AsSha512Mechanism()),
        kgo.ConsumerGroup(consumerGroupId),
        kgo.ConsumeTopics(topics...),
        kgo.WithLogger(kzap.New(logger.GetLogger())),
    )

The requirements for the authentication were:

  • SSL: false
  • security protocol: SASL_PLAINTEXT
  • SASL mechanism: SCRAM-SHA-512
  • Username: <>
  • Password: <>

I tried everything from the documentation. Even took help of google bard and Bing AI and tried all possible solution, still this issue is persisting.


Solution

  • There was no issue with the package. The code was not getting deployed and hence the issue was not with the code but the deployment.