Skip to content

Not getting records for S3Event (version 2.1) #481

Open

Description

@konstantinj

I have issues getting my s3 event to run in my tests. I've captured this event from an actual file uploaded to my bucket.
Using the event from #187 is working for me - I get 1 record out of it.

Why is my event no working?

    @ParameterizedTest
    @Event(value = "test_s3_event.json", type = S3Event.class)
    public void testHandleRequest(S3Event s3Event) throws Exception {
        log.info("records: {}", String.valueOf(s3Event.getRecords().size()));
        ...
{
  "records": [
    {
      "awsRegion": "eu-central-1",
      "eventName": "ObjectCreated:Put",
      "eventSource": "aws:s3",
      "eventTime": 1717616806478,
      "eventVersion": "2.1",
      "requestParameters": {
        "sourceIPAddress": "127.0.0.1"
      },
      "responseElements": {
        "xAmzId2": "HS/nsizcytYaTZTVS6Wp9bdGtqcFSZCZkkCjNFJlHV6qhAWA4eLTjp+f26A1v86EyUSK5V9p+ajpnMaDKFUvX8twd3TlR1iB",
        "xAmzRequestId": "78T4D27EB3E35ECE"
      },
      "s3": {
        "configurationId": "NWIxNzFhZjUtYjNiOC00OTQ0LTlkODctYzhhYWMwZjAyNTRk",
        "bucket": {
          "name": "XXXXXX",
          "ownerIdentity": {
            "principalId": "ARYPPZZK7WW18"
          },
          "arn": "arn:aws:s3:::XXXXXX"
        },
        "object": {
          "key": "events/incoming/tracking_events.jsonl",
          "size": 3955,
          "eTag": "db53c028474115bd80133bac8a7a952a",
          "versionId": "",
          "sequencer": "006660C0A66E018430",
          "urlDecodedKey": "events/incoming/tracking_events.jsonl",
          "sizeAsLong": 3955
        },
        "s3SchemaVersion": "1.0"
      },
      "userIdentity": {
        "principalId": "AWS:AROA2KCWJBBZLKXQRZC6W:XXXXXX"
      }
    }
  ]
}

Activity

  1. stevenl commented on Aug 29, 2024

    @stevenl

    I just faced this issue myself. The problem is not a bug in your code, but that the request data does not match the API. records is required to be capitalized:

    {
      "Records": [
        {
          "awsRegion": "eu-central-1",
          ...
    }
    

    For reference, see https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html

  2. josemarflausino commented on Oct 9, 2025

    @josemarflausino

    Any fix to this? I'm facing the same problem with SQSEvent. Version 3.16.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions