quarkus: quarkus-amazon-lambda @Inject still doesn't work in JVM mode
Describe the bug What is happening on #3354 is still happening: after deploying the JVM project, I get NPE in CloudWatch because the injected stuff is null.
Expected behavior I’d like to have the services injected properly, not null…
Actual behavior I follow all the indications in the guide https://quarkus.io/guides/amazon-lambda and the @ Inject members are null.
To Reproduce Steps to reproduce the behavior: I changed the inputs because my existing lambda reacts to a CloudWatch event, didn’t want to fiddle with working AWS settings.
- generate a new project with the quarkus-amazon-lambda-archetype
- add to the ProcessingService a new function
public String test() {
return "done";
}
- modify the TestLambda to
implements RequestHandler<Object, Object>
- modify its handleRequest to
@Override
public Object handleRequest(Object input, Context context) {
return service.test();
}
- deploy to AWS Lambda and lo, NPE
Environment (please complete the following information):
- Output of
uname -a
orver
: Windows 10 - Output of
java -version
: 11 - GraalVM version (if different from Java):
- Quarkus version or git rev: 1.4.2.Final
- Build tool (ie. output of
mvnw --version
orgradlew --version
): Maven 3.6.3
Additional context I must also say that I don’t really understand what their mentioned “correct way” is in #3354, as it’s not detailed, so the problem might be in front of the keyboard.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (20 by maintainers)
I’ll let you and @oztimpower figure it out. If you both think it should be reopened, I’ll gladly reopen it
I note you listed the handler explicitly, is there a reason for this? If you look at the templates I am invoking, the handler is fixed as Quarkus; your handler is determined at build time via the Named annotation, and corresponding property in the application.properties.
I suspect this is your issue. If you use the SAM Local, which can run on Windows, you will see the definition, and also the templated target/manage.sh.
This is documented in the Quarkus Amazon Lambda guide
You have listed handler as:
handler: org.sorincos.TestLambda::handleRequest
when it is fixed as in the Quarkus templates:
io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest
Will take a look. Give me a few days.