-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
file:///app/node_modules/@platformatic/kafka/dist/clients/producer/producer.js:233
const leader = metadata.topics.get(topic).partitions[partition].leader;
^
TypeError: Cannot read properties of undefined (reading 'leader')
at file:///app/node_modules/@platformatic/kafka/dist/clients/producer/producer.js:233:80
at file:///app/node_modules/@platformatic/kafka/dist/clients/base/base.js:274:21
at file:///app/node_modules/@platformatic/kafka/dist/clients/base/base.js:209:17at file:///app/node_modules/@platformatic/kafka/dist/clients/base/base.js:258:13
at worked (/app/node_modules/fastq/queue.js:222:14)
at #onData (file:///app/node_modules/@platformatic/kafka/dist/network/connection.js:403:13)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
Hello, I'm unsure if I can call this as an issue or rather "community help" but I am not able to find a proper configuration for the send method to avoid causing the crash.
My Kafka configuration is a KRAFT Kafka v3.7.0 , single node (for dev envs)
export const producer = new Producer({
clientId: 'openstack-cloud-v3-api-gateway',
bootstrapBrokers: [kafka_brokers],
autocreateTopics: true,
serializers: stringSerializers,
connectTimeout: 10000,
retries: 3,
retryDelay: 1000
// Removed fixed partitioner that was causing partition skew
// partitioner: () => 0 forces all messages to partition 0
})
This is how i initialize my producer if i set partitioner to 0 it always works without issues, but I have 4 partitions in my topic. and wouldn't like that all messages go into just 1.
This is how I send
await producer.send({
messages: [
{
topic: "logs.audit",
value: JSON.stringify(info)
}
],
// acks: 1 //To set to -1 in production environment
});
Maybe it's unclear to me, what i'm doing wrong but I can't find the proper initialization to avoid crashing the app? what is the proper partitioner setting at this point comes to mind? Or how can i set it?
Thank you,
Simone
Metadata
Metadata
Assignees
Labels
No labels