Skip to content

fix(kafka): return None for the value of tombstone records - #8925

Open
sumedh-aerram wants to merge 1 commit into
aws-powertools:developfrom
sumedh-aerram:fix/kafka-tombstone-value
Open

sumedh-aerram wants to merge 1 commit into
aws-powertools:developfrom
sumedh-aerram:fix/kafka-tombstone-value

Conversation

@sumedh-aerram

Copy link
Copy Markdown
Contributor

Issue number:

closes #8888

Summary

Changes

ConsumerRecordRecords.value read self["value"], so a tombstone record raised KeyError when Lambda delivers it without a value field. With "value": null, it failed inside the deserializer instead. value now returns None in both cases before any deserializer runs, the same way key handles a missing key. original_value returns None as well (typed str | None), matching original_key.

The Kafka docs table now says value and original_value are None for a tombstone record.

User experience

Before: reading record.value on a tombstone, such as a Debezium delete on a compacted topic, raised, and the batch was retried. After: record.value is None and the key is still deserialized, so handlers can process deletes.

Verification

I used an AI assistant (Claude) to help write this change. I ran every check above and reviewed the diff myself.


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

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@sumedh-aerram
sumedh-aerram requested a review from a team as a code owner November 28, 2026 23:55
@sumedh-aerram
sumedh-aerram requested a review from svozza November 28, 2026 23:55
@boring-cyborg boring-cyborg Bot added documentation Improvements or additions to documentation tests labels Nov 28, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Kafka consumer fails on tombstone records (no value)

1 participant