Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for undefined OldImage in Dynamo stream events #11665

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

benmartin-coforma
Copy link
Contributor

Description

We create Kafka messages from AWS event streams, which can be triggered by activity in DynamoDB. Usually, the event contains both a "before" and "after" of the object - but when the event is an insert, there is no "before". That is, event.Records[n].dynamodb.OldImage will be undefined. Unless we account for this, it will cause an error when we attempt to unmarshall it.

This is a low-impact bug; subsequent updates to that record will go through just fine, because they will have an OldImage. This PR just cleans up the initial edge case.

Related ticket(s)

CMDCT-3431


How to test

🤷‍♂️ I guess we just merge it, and then watch the logs from our postKafkaData lambda?

Notes

n/a


Pre-review checklist

  • I have performed a self-review of my code
  • I have added thorough tests, if necessary
  • [ ] I have updated relevant documentation, if necessary

Pre-merge checklist

Review

  • [ ] Design: This work has been reviewed and approved by design, if necessary
  • [ ] Product: This work has been reviewed and approved by product owner, if necessary

Security

If either of the following are true, notify the team's ISSO (Information System Security Officer).

  • [ ] These changes are significant enough to require an update to the SIA.
  • [ ] These changes are significant enough to require a penetration test.

Copy link

codeclimate bot commented Apr 11, 2024

Code Climate has analyzed commit 92e35e4 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (90% is the threshold).

This pull request will bring the total coverage in the repository to 96.8% (0.0% change).

View more on Code Climate.

@benmartin-coforma benmartin-coforma merged commit 36d611c into main Apr 16, 2024
18 checks passed
@benmartin-coforma benmartin-coforma deleted the kafka-fix-3431 branch April 16, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants