-
-
Notifications
You must be signed in to change notification settings - Fork 565
Description
Describe the bug
When running a KafkaJS consumer against a Kafka 4.0.0
(KRaft mode) broker, the consumer fails to join the group and repeatedly logs the error:
[Connection] Response GroupCoordinator(key: 10, version: 2) broker: localhost:29092 clientId: my-consumer error: The group coordinator is not available
This issue occurs when trying to auto-create the __consumer_offsets
topic, which fails in KRaft mode, causing the consumer group coordination to be unavailable.
To Reproduce
Steps to reproduce the behavior:
- Set up a Kafka broker using
apache/kafka:4.0.0
Docker image in KRaft mode - Run a simple producer sending messages to a topic using KafkaJS
- Run a consumer with
groupId
using KafkaJS subscribing to that topic - Observe the error in the consumer logs
Expected behavior
Consumer should successfully connect to the broker, join the group, and start consuming messages.
Observed behavior
Consumer keeps retrying to connect to the group coordinator and logs the following error repeatedly:
[Connection] Response GroupCoordinator(key: 10, version: 2) broker: localhost:29092 clientId: my-consumer error: The group coordinator is not available
And on the broker side:
Sent auto-creation request for Set(__consumer_offsets) to the active controller.
org.apache.kafka.common.network.InvalidReceiveException: Invalid receive (size = -720899)
Environment
- OS: Ubuntu 22.04 (VMware)
- KafkaJS version: 2.2.4
- Kafka version: 4.0.0 (KRaft mode)
- NodeJS version: 20.11.0
- Docker: 25.0.3
Additional context
This issue seems to be related to the recent changes in Kafka 4.x KRaft mode group management and how KafkaJS interacts with the GroupCoordinator API.
Temporary workaround:
Downgrading Kafka to 3.6.1
resolves the issue as group management is compatible in that version.