-
Notifications
You must be signed in to change notification settings - Fork 615
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
Issues with ScheduledEvent in lambdas using java 17 #1033
Comments
I'm experiencing the same issue after upgrading to
Downgrading back to version |
I can't seem to reproduce it, so need some help.
|
Also, I am noticing that you are using old version of spring* Since you are using Java 17, you should be 2022.0.2 |
In any event i need detailed instructions on how to reproduce otherwise there is nothing to fix |
I'm experiencing it with 2022.0.2. Sample
The Event consumer
application.yml
Running the app: mvn clean package
unzip -o -q -d ./target/docker ./target/lambda.jar
docker run --rm \
-e MAIN_CLASS=com.example.DynamodbEventConsumer \
-v "/${PWD}/target/docker":/var/task \
public.ecr.aws/shogo82148/lambda-java:17 \
org.springframework.cloud.function.adapter.aws.FunctionInvoker \
'... ddb event ...' results in: {"errorType":"java.lang.ClassCastException","errorMessage":"class [B cannot be cast to class com.amazonaws.services.lambda.runtime.events.DynamodbEvent ([B is in module java.base of loader 'bootstrap'; com.amazonaws.services.lambda.runtime.events.DynamodbEvent is in unnamed module of loader com.amazonaws.services.lambda.runtime.api.client.CustomerClassLoader @7cc355be)","stackTrace":["org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.invokeConsumer(SimpleFunctionRegistry.java:990)","org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.doApply(SimpleFunctionRegistry.java:701)","org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.apply(SimpleFunctionRegistry.java:550)","org.springframework.cloud.function.adapter.aws.FunctionInvoker.handleRequest(FunctionInvoker.java:85)"]}
It works when downgrading to spring-cloud version 2021.0.6 as @wsoderlu suggests. |
Could you push the whole sample project to the GitHib or attach in the Zip file? |
. . . or at least paste a JSON representing DynamodbEvent |
I used the event from https://github.com/aws/aws-lambda-go/blob/main/events/testdata/dynamodb-event.json and still can't reproduce so, please push a sample project to GitHub |
This event also works for me. The only difference with the event in your example and mine is the Defining an ObjectMapper bean with the following module fixes the mapping issue for me:
Maybe this module was registered somewhere before when in more recent versions (after 2021.0.6) its not? |
ahha, that helps |
Fixed and the best part is that we're in the middle of the release so 4.0.3 will be available today/tomorrow ;) |
Describe the bug
Since upgrading
org.springframework.cloud:spring-cloud-dependencies
from2021.0.6
->2021.0.7
we started facing issues with lambda executions utilizingScheduledEvent
from cloudwatch events.For now we've fixed this by downgrading to
2021.0.6
version which seems to do the trick.Error:
java.lang.ClassCastException: class [B cannot be cast to class com.amazonaws.services.lambda.runtime.events.ScheduledEvent ([B is in module java.base of loader 'bootstrap'; com.amazonaws.services.lambda.runtime.events.ScheduledEvent is in unnamed module of loader 'app')
Sample
Create lambda using provided java 17 runtime and trigger it through scheduled cloudwatch events using
ScheduledEvent
fromcom.amazonaws.services.lambda.runtime.events.ScheduledEvent
.Manual invocations from lambda console still works.
The text was updated successfully, but these errors were encountered: