-
Notifications
You must be signed in to change notification settings - Fork 313
[BUG] NullPointerException on S3 Delete Event Due to Null Object Size #5448
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Describe the bug
When processing S3 delete events, data-prepper throws a NullPointerException because the object size is null.
To Reproduce
- Configure an S3 bucket with SQS Event Notifcations and ObjectDelete enabled.
- Delete a file from the monitored S3 bucket.
- The following error will occur:
[s3-source-sqs-1] ERROR org.opensearch.dataprepper.plugins.source.s3.SqsWorker - Unable to process SQS messages. Processing error due to: Cannot invoke "java.lang.Long.longValue()" because the return value of "org.opensearch.dataprepper.plugins.source.s3.S3EventNotification$S3ObjectEntity.getSizeAsLong()" is null
Pipeline config:
S3-pipeline:
source:
s3:
notification_type: sqs
codec:
csv:
compression: none
sqs:
queue_url: "https://sqs.us-east-2.amazonaws.com/someQueue"
aws:
region: "us-east-2"
sts_role_arn: "someArn"
sink:
- stdout:
Expected behavior
The application should gracefully handle S3 delete events without throwing an exception. The object size should default to 0 when not present in the event notification.
Proposed Fix
- Add a null check for
getSizeAsLong()in theParsedMessageclass. - Default object size to
0Lif the value is null.
Environment (please complete the following information):
- OS: MacOS 14.7 Sonoma
- Data Prepper 2.10.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done