Skip to content

fix(kafka): handle tombstone events without value#5017

Merged
dreamorosi merged 2 commits intoaws-powertools:mainfrom
haslers:main
Feb 17, 2026
Merged

fix(kafka): handle tombstone events without value#5017
dreamorosi merged 2 commits intoaws-powertools:mainfrom
haslers:main

Conversation

@haslers
Copy link
Copy Markdown
Contributor

@haslers haslers commented Feb 16, 2026

Summary

The Kafka consumer was failing when processing messages with undefined values because the value getter attempted to deserialize undefined values, causing a TypeError when fromBase64 tried to access the length property of undefined.

Changes

Fixed the issue by adding an undefined check to the value getter in the consumer.
When a tombstone event without a message (i.e, value is undefined) is encountered, the consumer now properly returns undefined instead of throwing an error.

Updated type definitions to allow undefined values in the deserialization chain and added comprehensive test coverage for undefined value scenarios.

Issue number: closes #5016


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Co-authored-by: Bertram Vogel <bertram.vogel@codecentric.de>
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Feb 16, 2026

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size Bot added the size/M PR between 30-99 LOC label Feb 16, 2026
@dreamorosi dreamorosi changed the title fix(kafka): handle (tombstone) events with missing or empty value fix(kafka): handle tombstone events without value Feb 16, 2026
@sonarqubecloud
Copy link
Copy Markdown

@dreamorosi dreamorosi merged commit 79553c9 into aws-powertools:main Feb 17, 2026
46 checks passed
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Feb 17, 2026

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR between 30-99 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Follow-Up - Kafka Consumer fails when consuming tombstone events (i.e. message value = undefined)

2 participants