You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call twice the fetchTopicMetadata function of admin client, I get the following error :
TypeError: Cannot read property 'topicMetadata' of null
at Object.fetchTopicMetadata (/home/user/kafkajs-test/node_modules/kafkajs/src/admin/index.js:591:24)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async /home/user/kafkajs-test/admin.js:22:5
To have this error, the first call of fetchTopicMetadata must be on an existed topic and the second call on a non-existent topic.
To reproduce :
const{ Kafka }=require("kafkajs");constkafka=newKafka({clientId: "kafkajs-test.admin",brokers: ["kafka-1:9092","kafka-2:9092","kafka-3:9092"]});constadmin=kafka.admin();(async()=>{awaitadmin.connect();try{awaitadmin.fetchTopicMetadata({topics: ["topic1"]// topic1 exists => no error});}catch(e){console.error("topic1 error",e);}try{awaitadmin.fetchTopicMetadata({topics: ["topic2"]// topic2 does not exist => Cannot read property 'topicMetadata' of null });}catch(e){console.error("topic2 error",e);}awaitadmin.disconnect();})();
Normally, the fetchTopicMetadata function generates a KafkaJSProtocolError error with type UNKNOWN_TOPIC_OR_PARTITION if topic does not exist.
The text was updated successfully, but these errors were encountered:
I think the problem is in the refreshMetadataIfNecessary function. If I force the refresh like this by checking if the requested topics are in the cache, it works !
When I call twice the
fetchTopicMetadata
function of admin client, I get the following error :To have this error, the first call of
fetchTopicMetadata
must be on an existed topic and the second call on a non-existent topic.To reproduce :
Normally, the
fetchTopicMetadata
function generates a KafkaJSProtocolError error with typeUNKNOWN_TOPIC_OR_PARTITION
if topic does not exist.The text was updated successfully, but these errors were encountered: