-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Parsing clientContext header seems to be broken in quarkus-amazon-lambda extension #9395
Comments
/cc @patriot1burke |
I guess, this issue occurs because of the wrong third argument |
Hello @miron4dev, would you like to open a PR with your proposed fix? |
It looks like the actual issue is deeper than I expected. Replacing the third argument by So, now we're getting the actual error:
Here https://github.com/quarkusio/quarkus/blob/master/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaContext.java#L54 |
Working on a fix. |
FYI, this doesn't work in native because Quarkus is parsing the context. In a JVM deployment the lambda runtime is parsing the context. |
@arturs-cc How can I reproduce this? Not sure how to create the ClientContext header and the Java API accepts a string. This is the only docs I could find somehow that described the json. https://docs.aws.amazon.com/mobileanalytics/latest/ug/PutEvents.html |
@patriot1burke Just passing the json string to Java API will work.
|
Try my branch: https://github.com/patriot1burke/quarkus/tree/lambda-clientcontext Should be fixed. |
@arturs-cc @patriot1burke ClientContext must contain base64-encoded data, but AWS itself is responsible for decoding. The fix works like a charm if you remove |
Ok, took out the base64 decode should be good. Docs are horrible here. Either of you know how the Cognito header is passed? Couldn't find any info about it. |
@patriot1burke |
Read Lambda ClientContext correctly, Issue #9395
Describe the bug
This issue concerns two classes overriding the
startPollLoop(ShutdownContext context)
method.Namely:
Both of them creates a AbstractLambdaPollLoop object which takes 3 arguments.
In both of those cases AbstractLambdaPollLoop is created with those arguments:
AmazonLambdaMapperRecorder.objectMapper, AmazonLambdaMapperRecorder.cognitoIdReader, AmazonLambdaMapperRecorder.cognitoIdReader
Last argument is supposed to be
AmazonLambdaMapperRecorder.clientCtxReader
Expected behavior
ClientContext header is parsed and added to AWS Context.
Actual behavior
Exception is thrown:
{ "errorType": "com.fasterxml.jackson.databind.exc.InvalidDefinitionException", "errorMessage": "Cannot construct instance of `com.amazonaws.services.lambda.runtime.CognitoIdentity` (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information\n at [Source: (String)"<clientContextJSON>"; line: 1, column: 1]" }
<clientContextJSON> is whatever JSON was sent trough client context
Issue seems to be coming from using the wrong ObjectMapper.
To Reproduce
Steps to reproduce the behavior:
Important note: Somehow this manages to work in java8 runtime right now which i am unable to explain. So this bug only occurs when running in native mode. If you could guys help me explain that I would appreciate it.
Also it only occurs when there is actual data exchanged between lambdas so just invoking one of them won't cause this bug to happen
Environment (please complete the following information):
uname -a
orver
:Darwin localhost 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
java -version
:openjdk version "11.0.3" 2019-04-16
mvnw --version
orgradlew --version
):Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
If you require any other info or additional questions I will be happy to provide more.
The text was updated successfully, but these errors were encountered: