confluentinc / confluentinc/confluent-kafka-javascript

All parameters are not working as expected, and typescript definition does not match documentation fully

Open
#245 3 comments 0 reactions 1 assignee Claimed by @milindl View on GitHub
Dominant language
TypeScript
Stars
304
Forks
45
Avg merge
11h 47m
Merged PRs (30d)
5

Description

**Environment Information**
- OS [e.g. Mac, Arch, Windows 10]: Mac
- Node Version [e.g. 8.2.1]: v20.12.0
- NPM Version [e.g. 5.4.2]: 10.5.0
- C++ Toolchain [e.g. Visual Studio, llvm, g++]: g++
- confluent-kafka-javascript version [e.g. 2.3.3]: v1.2.0

**Steps to Reproduce**

- Follow the kafkajs configuration provided and run the code.
- you will see that debug logs are still getting printed, even though logLevel is WARN

**confluent-kafka-javascript Configuration Settings**
```
new KafkaJS.Kafka({
kafkaJS: {
brokers: [envConfig.kafka.bootstrapServers],
clientId: envConfig.serviceName,
ssl: true,
sasl: {
username: envConfig.kafka.saslUsername,
password: envConfig.kafka.saslPassword,
mechanism: 'plain',
},
connectionTimeout: 2000,
requestTimeout: 35000,
authenticationTimeout: 10000,
enforceRequestTimeout: true,
retry: {
initialRetryTime: 300,
maxRetryTime: 30000,
retries: 10,
},
logLevel: KafkaJS.logLevel.WARN,
logger: {
debug(message, extra) {
defaultLogger.debug('message: %s details: %j', message, extra);
},
info(message: string, extra?: object) {
defaultLogger.debug('message: %s details: %j', message, extra);
},
error(message: string, extra?: object) {
defaultLogger.debug('message: %s details: %j', message, extra);
},
warn(message: string, extra?: object) {
defaultLogger.debug('message: %s details: %j', message, extra);
},
namespace() {
return this;
},
setLogLevel() {},
}
},
});
```

**Additional context**

I am migrating from kafkajs to confluent-kafka-javascript.
I was following the documentation - https://github.com/confluentinc/confluent-kafka-javascript/blob/master/MIGRATION.md#kafkajs, but some of the parameters are simply not available or they are not working as expected.

e.g.
logLevel doesn't work.
log_cb have type any, and it's not clear if both params are provided which one will be used. like if I provide Kafkajs.logger and log_cb.
retry.restartOnFailure is not available in ts schema, even though docs say it's available.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.