Skip to content

MicronautRequestHandler - S3EventNotification not being mapped #2299

@romeoro

Description

@romeoro

Expected Behavior

S3EventNotification object should be mapped accordingly from the input json event.

Actual Behaviour

S3EventNotification is null.

Steps To Reproduce

No response

Environment Information

Very simple test function:

import com.amazonaws.services.lambda.runtime.events.models.s3.S3EventNotification
import io.micronaut.function.aws.MicronautRequestHandler
import io.micronaut.serde.annotation.Serdeable
import org.slf4j.Logger
import org.slf4j.LoggerFactory

@Serdeable
class S3EventHandler : MicronautRequestHandler<S3EventNotification, Void>() {
    private val logger: Logger = LoggerFactory.getLogger(S3EventHandler::class.java)

    override fun execute(input: S3EventNotification): Void? {
        logger.info("Received S3 event: {}", input)
        return null
    }
}

Invoked with example event:

{
    "version": "0",
    "id": "18b9ff9b-ee86-7754-4879-9d047331c10b",
    "detail-type": "Object Created",
    "source": "aws.s3",
    "account": "1234",
    "time": "2025-02-18T17:30:45Z",
    "region": "eu-central-1",
    "resources": [
        "arn:aws:s3:::random-bucket-name-123"
    ],
    "detail": {
        "version": "0",
        "bucket": {
            "name": "[randomname](arn:aws:s3:::random-bucket-name-123)"
        },
        "object": {
            "key": "test.jpg",
            "size": 135359,
            "etag": "8092708f08ac2177325d0cea8f9aae93",
            "sequencer": "0067B4B5B5AA204555"
        },
        "request-id": "2QFRRR8K44ZW7DH3",
        "requester": "1234",
        "source-ip-address": "1.1.1.1",
        "reason": "PutObject"
    }
}

Example Application

No response

Version

4.7.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions