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

[BUG] NullPointerException on S3 Delete Event Due to Null Object Size #5448

Open
jmsusanto opened this issue Feb 20, 2025 · 0 comments · May be fixed by #5449
Open

[BUG] NullPointerException on S3 Delete Event Due to Null Object Size #5448

jmsusanto opened this issue Feb 20, 2025 · 0 comments · May be fixed by #5449
Labels
bug Something isn't working untriaged

Comments

@jmsusanto
Copy link
Contributor

jmsusanto commented Feb 20, 2025

Describe the bug
When processing S3 delete events, data-prepper throws a NullPointerException because the object size is null.

To Reproduce

  1. Configure an S3 bucket with SQS Event Notifcations and ObjectDelete enabled.
  2. Delete a file from the monitored S3 bucket.
  3. 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 the ParsedMessage class.
  • Default object size to 0L if the value is null.

Environment (please complete the following information):

  • OS: MacOS 14.7 Sonoma
  • Data Prepper 2.10.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
Development

Successfully merging a pull request may close this issue.

1 participant