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

Producer Initialisation Fails, when we enable SASL and its not supported by the module #3022

Open
rahulkallur opened this issue Nov 30, 2024 · 1 comment
Labels
stale Issues and pull requests without any recent activity

Comments

@rahulkallur
Copy link

config := sarama.NewConfig()
config.Producer.Return.Successes = true
config.Net.SASL.Enable = true
config.Net.SASL.User = os.Getenv("KAFKA_USERNAME")
config.Net.SASL.Password = os.Getenv("KAFKA_PASSWORD")
config.Net.SASL.Mechanism = sarama.SASLTypeSCRAMSHA512 // Specify the mechanism

// // Provide the SCRAM client generator function
config.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient {
	// Create and return a custom SCRAM client
	// You can pass in your own credentials or change the default behavior here
	return sasl.NewSCRAMClient(
		"username", // replace with your username
		"password", // replace with your password
	)
}

The above is the sample code which i used for initializing the producer, but i am gettting something like this
kafka: invalid configuration (A SCRAMClientGeneratorFunc function must be provided to Net.SASL.SCRAMClientGeneratorFunc)
2024/11/30 05:57:09 Failed to create Kafka producer: kafka: invalid configuration (A SCRAMClientGeneratorFunc function must be provided to Net.SASL.SCRAMClientGeneratorFunc)

Copy link

Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur.
Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.

@github-actions github-actions bot added the stale Issues and pull requests without any recent activity label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues and pull requests without any recent activity
Projects
None yet
Development

No branches or pull requests

1 participant