mirror of
https://github.com/floci-io/floci.git
synced 2026-11-29 16:35:29 -05:00
fix(dynamodb): emit INSERT when UpdateItem creates the item (#7432)
An UpdateItem, or a transactional Update, on a key with no stored item labelled its DynamoDB Streams record and its Kinesis destination record MODIFY. AWS labels a write that adds a new item INSERT, and PutItem already did. Stream consumers that branch on eventName missed the creation. Pick the event name from whether an item existed before the update, as PutItem does, for both sinks. Closes #7431
This commit is contained in:
1 parent
7d84ce47e8
commit
e27aa382e1
3 files changed
+184
-2
No files matched your search
@@ -1521,12 +1521,13 @@ public class DynamoDbService {
|
||||
// and resolving the account inside the lambda would fall back to the default account,
|
||||
// which is the ambient-account bug this commit exists to remove.
|
||||
String ownerAccountId = regionResolver.getAccountId();
|
||||
String eventName = existing == null ? "INSERT" : "MODIFY";
|
||||
Runnable streamEvent = () -> {
|
||||
if (streamService != null) {
|
||||
streamService.captureEvent("MODIFY", existing, item, table, region);
|
||||
streamService.captureEvent(eventName, existing, item, table, region);
|
||||
}
|
||||
if (kinesisForwarder != null) {
|
||||
kinesisForwarder.forward("MODIFY", existing, item, table, region, ownerAccountId);
|
||||
kinesisForwarder.forward(eventName, existing, item, table, region, ownerAccountId);
|
||||
}
|
||||
};
|
||||
if (deferredStreamEvents != null) {
|
||||
|
||||
Reference in new issue
Block a user