Description
According to the documentation on https://docs.powertools.aws.dev/lambda/java/utilities/serialization/, I have to:
a) Add the dependency:
implementation 'software.amazon.lambda:powertools-serialization:1.17.0'
b) Use the extractDataFrom method to serialize the object, like this:
extractDataFrom(event).as(Product.class);
I just started a fresh project, and importing powertools-serialization:1.17.0 brings along com.fasterxml.jackson.core:jackson-databind:2.9.9
Now, when I try to use it with a valid request:
There is a problem with EventPart.as, as it uses this line:
But the method readValue(String sourceContent. Class valueClazz) is not available on version 2.9.9 of the Jackson ObjectMapper, so I end up getting a “NoSuchMethod” exception:
Now, if I manually update the version of Jackson-databind to 2.12, this works perfectly:
Possible Solution
Enforce the jackson-databind dependency (2.15.2) in the serialization module so that maven does not take the transitive one from jmespath (2.9.9)
Environment
- Powertools for AWS Lambda (Java) version used: 1.17.0
- Packaging format (Layers, Maven/Gradle): gradle
- AWS Lambda function runtime:
- Debugging logs