You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Rahul Singh <ra...@smartsensesolutions.com> on 2019/01/24 09:36:20 UTC

Error while creating topic using kafka-node client?

Hi All,

I am facing error while creating topic manually using kafka-node client.
The code is mentioned below.

Can anyone help please?

let topicsToCreate = [{ topic: topicName, partitions: 1, replicationFactor:
2 }];
        admin.createTopics(topicsToCreate, (err, data) => {
            if (err) {
                console.log(err)
            } else {
                console.log(data)
            }
        });

The error it is throwing is given below ::

Error: No broker with id undefined
    at KafkaClient.sendRequestToBroker
(/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:1089:21)
    at getController
(/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:1190:10)
    at loadMetadata
(/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:287:12)
    at async.series
(/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:892:7)
    at /Kafka/KafkaDemo/node_modules/async/dist/async.js:3888:9
    at /Kafka/KafkaDemo/node_modules/async/dist/async.js:473:16
    at replenish (/Kafka/KafkaDemo/node_modules/async/dist/async.js:1006:25)
    at iterateeCallback
(/Kafka/KafkaDemo/node_modules/async/dist/async.js:995:17)
    at /Kafka/KafkaDemo/node_modules/async/dist/async.js:969:16
    at /Kafka/KafkaDemo/node_modules/async/dist/async.js:3885:13

Re: Error while creating topic using kafka-node client?

Posted by Christopher Bogan <am...@gmail.com>.
I'm in the same boat

On Thu, Jan 24, 2019, 4:36 AM Rahul Singh <
rahul.singh@smartsensesolutions.com wrote:

> Hi All,
>
> I am facing error while creating topic manually using kafka-node client.
> The code is mentioned below.
>
> Can anyone help please?
>
> let topicsToCreate = [{ topic: topicName, partitions: 1, replicationFactor:
> 2 }];
>         admin.createTopics(topicsToCreate, (err, data) => {
>             if (err) {
>                 console.log(err)
>             } else {
>                 console.log(data)
>             }
>         });
>
> The error it is throwing is given below ::
>
> Error: No broker with id undefined
>     at KafkaClient.sendRequestToBroker
> (/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:1089:21)
>     at getController
> (/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:1190:10)
>     at loadMetadata
> (/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:287:12)
>     at async.series
> (/Kafka/KafkaDemo/node_modules/kafka-node/lib/kafkaClient.js:892:7)
>     at /Kafka/KafkaDemo/node_modules/async/dist/async.js:3888:9
>     at /Kafka/KafkaDemo/node_modules/async/dist/async.js:473:16
>     at replenish
> (/Kafka/KafkaDemo/node_modules/async/dist/async.js:1006:25)
>     at iterateeCallback
> (/Kafka/KafkaDemo/node_modules/async/dist/async.js:995:17)
>     at /Kafka/KafkaDemo/node_modules/async/dist/async.js:969:16
>     at /Kafka/KafkaDemo/node_modules/async/dist/async.js:3885:13
>