-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
quarkus-amazon-lambda @Inject doesn't work in JVM mode #3354
Comments
https://stackoverflow.com/questions/56620352/quarkus-aws-lambda-function-cdi-doesnt-work-in-handler-class mentions CDI only works in native mode but I'm unable to find any official reference to this? |
@evanchooly any idea on this one? |
i'll take a look today. it's on my list to revisit that module today. |
having the serverless framework in the mix muddies the waters a bit but I'll see what I can find out. I think they're circumventing what what the quarkus module is doing somehow. |
Serverless Framework only uploads the deployment package and doesn't impact any code, the same can be done with SAM CLI or CloudFormation My colleague did the test on AWS SAM Local with the same result (running the uber jar) |
Were you able to revisit that part @evanchooly? Does this have anything to do with the LambdaRecorder in native vs JVM mode? |
In your case it's because the serverless framework is invoking at the wrong spot and the quarkus bits aren't actually bootstrapped. i have ideas on how to clean that up but they're (largely) part of a refactoring that's been blocked by other changes. I'm working on it now, though. |
Which other tickets are related to the refactor so I can have a look? Serverless Framework just invokes the handler you define just like you would in AWS SAM/AWS CLI/other frameworks, so I'm afraid this is not something related to Serverless Framework? |
Is there anything new? We have similar problems using |
Check the handler definition, it should be |
And it really works using #3354 (comment) this method 😮 Can you share how you got to the solution? |
The docs are being updated as we speak (release pending) but here you can see the handler definition: https://quarkus.io/guides/amazon-lambda#create-the-function I was able to run your project using the correct handler and correcting for a bug in checking the path ( if there is no path, the healthcheck code gets an NPE ). The |
@evanchooly can be this closed ? |
Describe the bug
@Inject of services is not working, throwing a nullpointer at runtime.
Expected behavior
Services are created and injected
Actual behavior
No injection is happening:
To Reproduce
Steps to reproduce the behavior:
git clone [email protected]:drissamri/quarkus-jvm-dev-bug.git
mvn clean package -DskipTests
serverless deploy
Environment (please complete the following information):
uname -a
orver
:java -version
:0.19.1
Additional context
I'm unable to test this locally due to #3352
Annotating the Handler class with @singleton doesn't help. I'm pretty sure it worked in native mode.
The text was updated successfully, but these errors were encountered: