Error in transaction creation based on Kafka record

Kibana version:
7.11.2
Elasticsearch version:
7.11.2
APM Server version:
7.11.2
APM Agent language and version:
java - 1.22.0

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
java client jar

Description of the problem including expected versus actual behavior. Please include screenshots

Our Application logs show

ERROR co.elastic.apm.agent.kafka.helper.ConsumerRecordsIteratorWrapper - Error in transaction creation based on Kafka record

Our insights are around a message headers key/value having a null value and apm failing to capture such messages .

Provide logs and/or server output (if relevant):


    at java.lang.Thread.run(Thread.java:834) [?:?]
    2021-06-03 17:01:55	
    
    	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    2021-06-03 17:01:55	
    
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
    2021-06-03 17:01:55	
  
    	at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:1073) [spring-kafka-2.6.4.jar!/:2.6.4]
    2021-06-03 17:01:55	
    
    	at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1176) [spring-kafka-2.6.4.jar!/:2.6.4]
    2021-06-03 17:01:55	
  
    	at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1529) [spring-kafka-2.6.4.jar!/:2.6.4]
    2021-06-03 17:01:55	

    	at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:1810) [spring-kafka-2.6.4.jar!/:2.6.4]
    2021-06-03 17:01:55	
  
    	at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:1911) [spring-kafka-2.6.4.jar!/:2.6.4]
    2021-06-03 17:01:55	
   
    	at co.elastic.apm.agent.kafka.helper.ConsumerRecordsIteratorWrapper.next(ConsumerRecordsIteratorWrapper.java:42) [?:?]
    2021-06-03 17:01:55	
    
    	at co.elastic.apm.agent.kafka.helper.ConsumerRecordsIteratorWrapper.next(ConsumerRecordsIteratorWrapper.java:100) [?:?]
    2021-06-03 17:01:55	
   
    	at co.elastic.apm.agent.impl.context.Message.addHeader(Message.java:127) ~[?:?]
    2021-06-03 17:01:55	
   
    	at co.elastic.apm.agent.impl.context.Headers.add(Headers.java:47) ~[?:?]
    2021-06-03 17:01:55	
  
    	at co.elastic.apm.agent.util.BinaryHeaderMap.add(BinaryHeaderMap.java:76) ~[?:?]
    2021-06-03 17:01:55	
    
    	at co.elastic.apm.agent.util.IOUtils.decodeUtf8Bytes(IOUtils.java:130) ~[?:?]
    2021-06-03 17:01:55	
    
    java.lang.NullPointerException: null

For reference, here is the link to the related issue in the java agent.