Skip to content

Parsing clientContext header seems to be broken in quarkus-amazon-lambda extension #9395

@arturs-cc

Description

@arturs-cc

Describe the bug
This issue concerns two classes overriding the startPollLoop(ShutdownContext context) method.
Namely:

1. AmazonLambdaRecorder
2. FunqyLambdaBindingRecorder

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:

  1. Make two AWS lambdas where one invokes another trough direct invokation.(not trough API-GW) Make one of them fill clientContext and another to read it. Then trigger the sender lambda.

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):

  • Output of uname -a or ver: 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
  • Output of java -version: openjdk version "11.0.3" 2019-04-16
  • Quarkus version or git rev: One lambda was using 1.3.2.Final and other 1.4.2.Final.
  • Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

If you require any other info or additional questions I will be happy to provide more.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions