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

MicronautRequestHandler - S3EventNotification not being mapped #2299

Open
romeoro opened this issue Feb 18, 2025 · 2 comments
Open

MicronautRequestHandler - S3EventNotification not being mapped #2299

romeoro opened this issue Feb 18, 2025 · 2 comments

Comments

@romeoro
Copy link

romeoro commented Feb 18, 2025

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

@driverpt
Copy link
Contributor

Did you add?

implementation("io.micronaut.aws:micronaut-aws-lambda-events-serde")

@romeoro
Copy link
Author

romeoro commented Feb 27, 2025

Yes, number 3 in the list, all dependencies included have been:

dependencies {
    ksp("io.micronaut.serde:micronaut-serde-processor")
    implementation("com.amazonaws:aws-lambda-java-events")
    implementation("io.micronaut.aws:micronaut-aws-lambda-events-serde")
    implementation("io.micronaut.aws:micronaut-function-aws")
    implementation("io.micronaut.crac:micronaut-crac")
    implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
    implementation("io.micronaut.serde:micronaut-serde-jackson")
    implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
    runtimeOnly("ch.qos.logback:logback-classic")
    runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants