ConsumerGroup consumerOptions Configuration error @types/kafka-node

270 views Asked by At

I'm trying to use consumerGroup instead of HighLevelConsumer in a typescript project, but I'm not able to configure consumerOptions for consumerGroup.

I am getting the following error when I assign

1) fromOffset: 'earliest'

Argument of type '{ autoCommit: boolean; fetchMaxBytes: number; fetchMaxWaitMs: number; fromOffset: string; groupId...' is not assignable to parameter of type 'ConsumerGroupOptions'. Types of property 'fromOffset' are incompatible. Type 'string' is not assignable to type '"earliest" | "latest" | "none"'.

2) protocol: ['roundrobin']

Argument of type '{ autoCommit: boolean; fetchMaxBytes: number; fetchMaxWaitMs: number; protocol: string[]; groupId...' is not assignable to parameter of type 'ConsumerGroupOptions'. Types of property 'protocol' are incompatible. Type 'string[]' is not assignable to type '("roundrobin" | "range" | CustomPartitionAssignmentProtocol)[]'. Type 'string' is not assignable to type '"roundrobin" | "range" | CustomPartitionAssignmentProtocol'.

3) outOfRangeOffset: 'earliest'

Argument of type '{ autoCommit: boolean; fetchMaxBytes: number; fetchMaxWaitMs: number; outOfRangeOffset: string; g...' is not assignable to parameter of type 'ConsumerGroupOptions'. Types of property 'outOfRangeOffset' are incompatible. Type 'string' is not assignable to type '"earliest" | "latest" | "none"'.

Environment details:

  • Node version: v8.11.1
  • Kafka-node version: v2.6.1
  • types/kafka-node: v2.0.6

Can anyone help me understand where I am going wrong? Thanks in advance.

0

There are 0 answers