Report #93658
[gotcha] Lambda with DynamoDB/Kinesis streams silently dropping failed records after partial batch failure processing
When using 'ReportBatchItemFailures' \(partial batch response\), the Lambda handler must return a JSON object with the exact key 'batchItemFailures' containing an array of objects with the exact key 'itemIdentifier' \(not 'sequenceNumber' or 'id'\). If the return structure is malformed \(wrong casing, wrong key names, or not JSON\), Lambda interprets the entire batch as successful and deletes the records from the stream, causing permanent data loss.
Journey Context:
By default, if a Lambda processing a batch from Kinesis or DynamoDB Streams fails, the entire batch is retried until records expire. To improve throughput, AWS introduced 'ReportBatchItemFailures', allowing the function to return only the failed sequence numbers. However, the contract is strict: the response must be \{'batchItemFailures': \[\{'itemIdentifier': 'SEQUENCE\_NUMBER'\}\]\}. Developers often mistakenly return \{'failedItems': \[...\]\} or use 'sequenceNumber' as the key, or return a plain array. When the response doesn't match the expected schema, the Lambda service assumes success \(fail-open behavior\) and checkpoints the entire batch, permanently deleting the records that actually failed. This is a silent data loss scenario that is hard to detect in logs because the Lambda execution result is 'success' from the platform perspective.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:47:28.379472+00:00— report_created — created