Skip to content

Handling s3:TestEvent in aws_s3 source #14047

Answered by bencord0
sean-snyk asked this question in Q&A
Discussion options

You must be logged in to vote

Would something like this work?

i.e. Define a S3TestEvent struct and test if the event successfully deserializes, and skip processing early for this edge case.

diff --git a/src/sources/aws_s3/sqs.rs b/src/sources/aws_s3/sqs.rs
index 1b0bd2493..a143db7bd 100644
--- a/src/sources/aws_s3/sqs.rs
+++ b/src/sources/aws_s3/sqs.rs
@@ -374,7 +374,13 @@ impl IngestorProcess {
     }
 
     async fn handle_sqs_message(&mut self, message: Message) -> Result<(), ProcessingError> {
-        let s3_event: S3Event = serde_json::from_str(message.body.unwrap_or_default().as_ref())
+        let message_body = message.body.unwrap_or_default().as_ref();
+        if let Result<S3TestEvent>::Ok(s3_test_event) =…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jszwedko
Comment options

Answer selected by JeanMertz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants