aws / aws-lambda-base-images

Apache License 2.0
669 stars 110 forks source link

amazon/aws-lambda-java:17.2023.10.16.09 breaks build with Jackson 2.15 #117

Closed matlik closed 10 months ago

matlik commented 11 months ago

When I create a Java lambda using version 17.2023.10.16.09, my lambda exits in error because it cannot find a field:

READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE: java.lang.NoSuchFieldError
java.lang.NoSuchFieldError: READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
        at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.createContextual(EnumDeserializer.java:211)
        at com.fasterxml.jackson.databind.DeserializationContext.handlePrimaryContextualization(DeserializationContext.java:836)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:550)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:294)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
        at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
        at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:621)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:188)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:28)
        at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:867)
        at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:659)
        at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4956)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4826)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3755)
        ... SNIP ...

I can make this error go away by reverting the build to version 17.2023.09.29.12. Or I can make this error go away by downgrading the version of Jackson I am using from 2.15.3 to 2.14.3.

Based on this, it would appear that something about using this base docker image, at least in the context of SAM CLI, is forcing the jackson-annotations package to an older (possibly 2.14.x) version despite the project code trying to use the newer 2.15.x version, resulting in the above exception.

smirnoal commented 11 months ago

thanks for reporting this issue. We are working on a fix. Meanwhile please use previous version of the image

thomasm-ttd commented 11 months ago

I am seeing the same issue when trying to run a lambda locally using the AWS Toolkit for Intellij. The run configuration is using the image: Using local image: public.ecr.aws/lambda/java:17-rapid-x86_64.

This image has the same error, and there doesn't appear to be a way to revert to an older image