It seems that GH-932 was broken in the scope of GH-966
kriehzoo opened this issue · 3 comments
Hi @olegz
First of all, thanks for your efforts and great work.
I am facing the same issue as described in GH-932 and after trying around for some hours now I hoped that the fix there should solve it. However, I am using 4.0.5 and the changes are not visible there. So after looking at the git history I realised that some of the changes were undone i the scope of GH-966.
Could it be that GH-932 is now broken again?
Your help would be very much appreciated.
To sum up what I am experiencing:
I implemented a functional bean and deployed it to AWS Lambda. It gets triggered by a putObject on an S3 bucket.
In CloudWatch I see that it detects the companion:
SOURCE: class org.springframework.cloud.function.adapter.aws.AWSCompanionAutoConfiguration
However, it seems that it never uses it and so AWSTypesMessageConverter
is never called.
And that would mean, that LambdaEventSerializers.serializerFor
is not called either.
IMHO this could be the reason for getting
23:44:29.099 [main] DEBUG o.s.c.f.c.c.JsonMessageConverter - Failed to convert value: {
"Records": [
{
"eventVersion": "2.1",
"eventSource": "aws:s3",
"awsRegion": "eu-central-1",
"eventTime": "2023-11-04T23:44:23.905Z",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "AWS:xxxxxxxxxxxxxxxxxxx"
},
"requestParameters": {
"sourceIPAddress": "x.x.x.x"
},
"responseElements": {
"x-amz-request-id": "xxxxxxxxxxxxxxxx",
"x-amz-id-2": "xxxxxxxxxxxxxxxxxxxx"
},
"s3": {
"s3SchemaVersion": "1.0",
"configurationId": "xxxxxxxxxxxxxxxxxxxxxxxx",
"bucket": {
"name": "xxxxxxxxxxxxxxx",
"ownerIdentity": {
"principalId": "xxxxxxxxxxxxxxxxxx"
},
"arn": "arn:aws:s3:::xxxxxxxxxxxxxxxxx"
},
"object": {
"key": "xxxxxxxxxxxxxxxx",
"size": 6064,
"eTag": "xxxxxxxxxxxxx",
"sequencer": "xxxxxxxxxxxxxx"
}
}
}
]
} to: class com.amazonaws.services.lambda.runtime.events.S3Event
and next
java.lang.IllegalStateException: Failed to convert. Possible bug as the conversion probably shouldn't have been attempted here
and
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of
com.amazonaws.services.lambda.runtime.events.models.s3.S3EventNotification$S3EventNotificationRecord (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
I also see
Failed to convert input '[B@5adb0db3' to type class com.amazonaws.services.lambda.runtime.events.S3Event. Will use it as is.
What is the signature of a function?
I am a little puzzled as we have extensive testing for S3. For example https://github.com/spring-cloud/spring-cloud-function/blob/main/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/test/java/org/springframework/cloud/function/adapter/aws/FunctionInvokerTests.java#L955
I am sorry for the late reply, but if you can get back to me shortly i'll give it a priority
I also want to see your functional bean registration. Something is definitely strange.
The
Failed to convert value: {
...
} to: class com.amazonaws.services.lambda.runtime.events.S3Event
This is strange given that the framework clearly sees the type, yet it skips over AWSTypesMessageConverter
for some reason.
Closing due to inactivity from the original reporter