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

It doesn't work #177

Open
arantesxyz opened this issue Apr 27, 2022 · 0 comments
Open

It doesn't work #177

arantesxyz opened this issue Apr 27, 2022 · 0 comments

Comments

@arantesxyz
Copy link

Tried the readme example:

const { JSConsumer, JSProducer } = require("sinek");

const config = {
  clientId: "my-app",
  brokers: ["localhost:9092"],
};

async function run() {
  const topic = "my-topic";

  const producer = new JSProducer(config);
  const consumer = new JSConsumer(topic, config);

  producer.on("error", (error) => console.error(error));
  consumer.on("error", (error) => console.error(error));

  await consumer.connect();

  // consume from a topic.
  consumer.consume(async (messages) => {
    messages.forEach((message) => {
      console.log(message);
    });
  });

  // Produce messages to a topic.
  await producer.connect();
  producer.send(topic, "a message");
}


run()

And it simply returns me this:

        const { "metadata.broker.list": brokerList, "client.id": clientId, "security.protocol": securityProtocol, "ssl.ca.location": sslCALocation, "ssl.certificate.location": sslCertLocation, "ssl.key.location": sslKeyLocation, "ssl.key.password": sslKeyPassword, "sasl.mechanisms": mechanism, "sasl.username": username, "sasl.password": password, } = config.noptions;
                                        ^

TypeError: Cannot destructure property 'metadata.broker.list' of 'config.noptions' as it is undefined.
    at new JSProducer (/home/arantes/tmp/kafka-test/node_modules/sinek/dist/lib/kafkajs/JSProducer.js:72:41)
    at run (/home/arantes/tmp/kafka-test/test.js:11:20)
    at Object.<anonymous> (/home/arantes/tmp/kafka-test/test.js:32:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Node.js v18.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant