Closed sturmm closed 4 years ago
What is the error that you are getting?
e.g.
com.amazonaws.serverless.exceptions.InvalidRequestEventException: Invalid Request: Illegal character in path at index 13: https://null/{proxy+}
at io.micronaut.function.aws.proxy.MicronautRequestReader.readRequest(MicronautRequestReader.java:123)
at io.micronaut.function.aws.proxy.MicronautRequestReader.readRequest(MicronautRequestReader.java:48)
at io.micronaut.function.aws.proxy.AbstractLambdaContainerHandler.proxy(AbstractLambdaContainerHandler.java:204)
at io.micronaut.function.aws.runtime.MicronautLambdaRuntime.startRuntimeApiEventLoop(MicronautLambdaRuntime.java:131)
at io.micronaut.function.aws.runtime.MicronautLambdaRuntime.main(MicronautLambdaRuntime.java:77)
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 13: https://null/{proxy+}
at java.net.URI.create(URI.java:852)
at io.micronaut.function.aws.proxy.MicronautAwsProxyRequest.getUri(MicronautAwsProxyRequest.java:193)
at io.micronaut.http.HttpRequest.getPath(HttpRequest.java:85)
at io.micronaut.function.aws.proxy.MicronautRequestReader.readRequest(MicronautRequestReader.java:79)
Caused by: java.net.URISyntaxException: Illegal character in path at index 13: https://null/{proxy+}
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at java.net.URI.create(URI.java:850)
... 7 more
After I got an idea what happend I tried the some test events in the AWS Lambda console which lead me to NullPointerExceptions
of properties that should not be null e.g. the AwsRequestContext
of AwsProxyRequest
where my test event was:
{
"resource": "/env",
"path": "/env",
"httpMethod": "GET",
"requestContext": {
"resource": "/env",
"path": "/env"
}
}
ThEn I replaced camelCase
named properties with snake_case
named (e.g. requestContext
with request_context
) and came a step further in the code.
But just from reading the code (with very basic knowledge of Micronaut) it seems, that the global ObjectMapper
is used for parsing JSON into AwsProxyRequest
which then lead to errors when I change the jackson config in application.yml
.
@alvarosanchez - I am facing something similar issue for response where I am trying to override ObjectMapper configuration to return null value keys in the response. Here is the bug link: https://github.com/micronaut-projects/micronaut-aws/issues/1077. Can you please help ?
@mayurtanna sorry but I'm no longer actively working on Micronaut. Someone else from @micronaut-projects/core-developers should be able to help.
@alvarosanchez okay, no worries. Thank you.
@sdelamo - Hi, would you be able to help please ?
I found a problem with the whole Lambda handling, when changing the configuration of the default
ObjectMapper
in Micronaut:This is because the
MicronautLambdaContainerHandler
uses the globalObjectMapper
. I would expect, that the framework would use a seperate one, which is configured to just met the Lambda specifications or at least that the properties of classes used for Lambda API (likeAwsProxyRequest
) are annotated with@JsonProperty
etc.Im using Micronaut
1.2.9