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
Describe the bug
When enabling debug logging to investigate an unrelated issue, we started seeing TypeErrors from the logger.
This appears to be because offsets are BigInts and JSON.stringify doesn't know how to serialize those:
> const val = { foo: 100n }
undefined
> JSON.stringify(val)
Uncaught TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
To Reproduce
Enable debug logging and run consumer.commitOffsets without first having run consumer.run. The debug message contains offsets which are BigInts.
Expected behavior
The log should serialize the bigints to strings.
Observed behavior
TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at /home/klarna/app/node_modules/kafkajs/src/loggers/console.js:5:24
at Object.debug (/home/klarna/app/node_modules/kafkajs/src/loggers/index.js:16:3)
at Runner.commitOffsets (/home/klarna/app/node_modules/kafkajs/src/consumer/runner.js:467:19)
at Object.commitOffsets (/home/klarna/app/node_modules/kafkajs/src/consumer/index.js:369:19)
at KafkaJsClient.commit (/home/klarna/app/pubsub/kafkajs/index.js:115:14)
at /home/klarna/app/consumer/index.js:314:101
at Runner.eachMessage (/home/klarna/app/pubsub/kafkajs/index.js:55:21)
at Runner.processEachMessage (/home/klarna/app/node_modules/kafkajs/src/consumer/runner.js:151:20)
at onBatch (/home/klarna/app/node_modules/kafkajs/src/consumer/runner.js:287:20)
Environment:
OS: Amazon Linux 2
KafkaJS version: 1.15.0
NodeJS version 12-something, but can reproduce in 14 and 16 as well
The text was updated successfully, but these errors were encountered:
Describe the bug
When enabling debug logging to investigate an unrelated issue, we started seeing TypeErrors from the logger.
This appears to be because offsets are BigInts and JSON.stringify doesn't know how to serialize those:
To Reproduce
Enable debug logging and run
consumer.commitOffsets
without first having runconsumer.run
. The debug message containsoffsets
which are BigInts.Expected behavior
The log should serialize the bigints to strings.
Observed behavior
Environment:
The text was updated successfully, but these errors were encountered: