micronaut-aws icon indicating copy to clipboard operation
micronaut-aws copied to clipboard

Support custom runtimes not only when using API Gateway Proxy

Open sdelamo opened this issue 5 years ago • 6 comments

Our current support for AWS Lambda for Custom runtimes depends on using the API Gateway proxy integration.

We should support using custom runtimes and GraalVM native image generation for every raw lambda functions.

sdelamo avatar Apr 20 '20 06:04 sdelamo

We have made progress to support any RequestHandler, see https://micronaut-projects.github.io/micronaut-aws/snapshot/guide/index.html#customRuntimeGraal

But we have to support Handlers implementing RequestStreamHandler. See:

https://github.com/micronaut-projects/micronaut-aws/blob/master/function-aws-custom-runtime/src/main/java/io/micronaut/function/aws/runtime/AbstractMicronautLambdaRuntime.java#L346-L349

sdelamo avatar Apr 27 '20 10:04 sdelamo

@sdelamo are you going to be able to complete this issue before AWS 2.0 release?

alvarosanchez avatar Jun 12 '20 07:06 alvarosanchez

@sdelamo @alvarosanchez too late already, the feature missed the boat

graemerocher avatar Jun 12 '20 07:06 graemerocher

@sdelamo Just to verify, this makes it impossible to port a RequestStreamHandler based lambda to graalvm using micronaut right? I suspect your link has changed over time. Regardless of the link, I simply get:

"{\"message\":\"Not Found\",\"_links\":{\"self\":{\"href\":\"https://nullnull\",\"templated\":false}},\"_embedded\":{\"errors\":[{\"message\":\"Page Not Found\"}]}}

....as reply for the invocations.

dsvensson avatar Mar 31 '22 14:03 dsvensson

Ever get anywhere with this? I am trying to read an SQSEvent and it works great on the JVM but the message always comes up null when I use a native-image.

Thanks.

charlie-harvey avatar Jul 26 '22 16:07 charlie-harvey

Adding this to my repo made it work with SQSEvent.

import com.amazonaws.services.lambda.runtime.events.SQSEvent
import io.micronaut.core.annotation.Introspected

@Introspected(classes = [SQSEvent.SQSMessage::class, SQSEvent.MessageAttribute::class])
class SQSEventConfiguration {
}

Add this to your ObjectMapper

MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES

charlie-harvey avatar Sep 01 '22 17:09 charlie-harvey