kafkajs
kafkajs copied to clipboard
createTopic() yields UNKNOWN_TOPIC_OR_PARTITION error
Describe the bug A clear and concise description of what the bug is.
To Reproduce
My code
const admin = gKafka.admin();
const topics = await admin.listTopics()
gConfig.logger.debug(`Available topics: ${JSON.stringify(topics)}`);
const [createError, createResult] = await to( admin.createTopics({
validateOnly: true,
waitForLeaders: true,
timeout: 5000,
topics: [
{
topic: '123',
numPartitions : 1,
replicationFactor : 2
}
],
}) );
// remember to connect and disconnect when you are done
await admin.connect()
await admin.disconnect()
Expected behavior Either notification that topic has been created or error message that topic has not been created for some reason.
Observed behavior
the listTopics call works fine.
The createTopic call yields a "This server does not host this topic-partition" error message.
Environment:
- Kafka Backend: Aiven (Azure Eventhub yields same result)
- Windows 10
- KafkaJS 1.15.0
@joerg-walter-de
I have faced a similar issue and identified that this is being caused by the parameter validateOnly
being set to true.
I couldn't find any issue from the actual library as it does mainly a proxy and forward to the broker.