localstack / localstack-java-utils

☕ Java utilities and JUnit integration for LocalStack
Apache License 2.0
75 stars 43 forks source link

ERROR: java.util.LinkedHashMap cannot be cast to APIGatewayProxyRequestEvent #77

Open fuzzy28 opened 3 years ago

fuzzy28 commented 3 years ago

Is there an existing issue for this?

Current Behavior

Unfortunately, the issue exists in the current docker build

localstack.services.awslambda.lambda_executors.InvocationException: Lambda process returned error status code: 1. Result: . Output:
Exception in thread "main" java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent is in unnamed module of loader 'app')
        at com.fitness.society.users.handlers.UserRegistrationAPIGatewayHandler.handleRequest(UserRegistrationAPIGatewayHandler.java:26)
        at cloud.localstack.LambdaExecutor.main(LambdaExecutor.java:119)

Expected Behavior

Should work with the below dependency as it was closed and verified in the original ticket https://github.com/localstack/localstack/issues/1634

   <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-events</artifactId>
        <version>2.0.2</version>
    </dependency>

How are you starting LocalStack?

With a docker run command

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run localstack/localstack

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

curl -X POST http://192.168.1.1:4566/restapis/mvy1yew0wa/prod/_user_request_/users

Environment

- OS: Amazon Linux2
- LocalStack: localstack/localstack   latest    087de49bf85a

Anything else?

No response

lakkeger commented 1 year ago

Hi! We just wanted to follow up to see whether your issue has been resolved. Were you able to get it working with the latest version of LocalStack? We would appreciate your feedback!