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

#97 Fixed deserializing of EventBridge object body #98

Closed
wants to merge 2 commits into from

Conversation

careri
Copy link

@careri careri commented Feb 16, 2024

Issue #97

Description of changes: Deserialize EventBridge body if JsonValueKind.Object

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

Copy link
Contributor

@normj normj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could add a unit test for this scenario that would be great.

@careri
Copy link
Author

careri commented Feb 19, 2024

Hi, unit test added. (The unit test fails with the old code).

@careri careri requested a review from normj February 19, 2024 09:45
@ashovlin ashovlin self-requested a review February 19, 2024 15:52
[Fact]
public async Task Deserialize_Eventbridge_Sqs_Envelope()
{
const string eventbridgeSqsEnvelope = "{\"Attributes\":{\"SenderId\":\"AIDAIP3MER2HFHNCCMVD4\",\"ApproximateFirstReceiveTimestamp\":\"1708335393527\",\"ApproximateReceiveCount\":\"1\",\"SentTimestamp\":\"1708335388527\"},\"Body\":\"{\\u0022version\\u0022:\\u00220\\u0022,\\u0022id\\u0022:\\u0022de3d19d6-755a-b9b1-c625-1708a2c36b50\\u0022,\\u0022detail-type\\u0022:\\u0022ChatMessage\\u0022,\\u0022source\\u0022:\\u0022ServiceNow/Integration\\u0022,\\u0022account\\u0022:\\u0022041717511598\\u0022,\\u0022time\\u0022:\\u00222024-02-19T09:36:28Z\\u0022,\\u0022region\\u0022:\\u0022eu-central-1\\u0022,\\u0022resources\\u0022:[],\\u0022detail\\u0022:{\\u0022id\\u0022:\\u00226ef9516a-6565-4e81-8177-be89d207fab0\\u0022,\\u0022source\\u0022:\\u0022ServiceNow/Integration\\u0022,\\u0022specversion\\u0022:\\u00221.0\\u0022,\\u0022type\\u0022:\\u0022ChatMessage\\u0022,\\u0022time\\u0022:\\u00222024-02-19T09:36:28.6090473\\u002B00:00\\u0022,\\u0022data\\u0022:\\u0022{\\\\\\u0022MessageDescription\\\\\\u0022:\\\\\\u0022Hello\\\\\\u0022}\\u0022}}\",\"MD5OfBody\":\"fa0ed402839bcce842343be5a5b0e758\",\"MD5OfMessageAttributes\":null,\"MessageAttributes\":{},\"MessageId\":\"83b53c15-8838-4ea1-89ae-97990548f8e4\",\"ReceiptHandle\":\"AQEBrLb6AkV/lUdrvNnEQjxK24LJLPU9\\u002BJko30VRmXIXljTrbfzHGZP3wuGCFSnaBUvUPTHGWU6rxRXCDnifFswSzuCyYjtJV95N3UajyEjkau\\u002BsBZdpYvWE4SKJSrh69HzKCS1QZ8Izula1jDA4dSYDl578kYY67uCKCvyRPtCKq7r5mveThv\\u002BRik1K9zmMrX9urwg8OgCsWcPEOu7duKJEsCSchorNoXjCVRycK7/mqyP1ndeiWc6SBefR9Coiynp2tsA6qFmkCwZNx4hqLINclkV4KyidX5cpdORMY74eoZ/puE6xrwQTJCJL2QKmnegxf645RL0i1tS2nSCeDUVwuQeebaSHbI0dKTyhtFvK/O2V8S39/siAHKz\\u002BCCaUo0YhtJ6FG1tm0xytwo5la2ysi5BKRrlf9thZ16pNaiNmKyI=\"}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please replace any sensitive info with dummy data? I'm particularly worried about "SenderId".

Copy link
Contributor

@philasmar philasmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the unit tests and integ tests internally and they pass for the current changes.

Copy link
Contributor

@96malhar 96malhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this issue via this PR - #114
It also adds end-to-end tests for EventBridge and SNS.

This PR can be closed.

@96malhar 96malhar closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants