micronaut-projects / micronaut-aws

Projects specific to integrating Micronaut and Amazon Web Services (AWS)
Apache License 2.0
87 stars 80 forks source link

No bean of type [io.micronaut.jackson.codec.JsonMediaTypeCodec] exists #26

Closed aarthisankaran closed 5 years ago

aarthisankaran commented 5 years ago

Trying to use the example: micronaut-aws/examples/api-proxy-graal-custom-runtime-example/

I am forced to use micronautVersion=1.1.0.M2

if not I get the error - Could not find or load main class io.micronaut.graal.reflect.GraalClassLoadingAnalyzer

But with 1.1.0.M2 deployed to Lambda I get below error { "errorMessage": "Error starting Micronaut container: No bean of type [io.micronaut.jackson.codec.JsonMediaTypeCodec] exists. Ensure the class is declared a bean and if you are using Java or Kotlin make sure you have enabled annotation processing." }

mrwilby commented 5 years ago

This seems to be the same issue as https://github.com/micronaut-projects/micronaut-core/issues/1533 ?

@graemerocher is there any workaround for this? We're seeing the same issue...

graemerocher commented 5 years ago

Please can you use the latest release. Graal support changed significantly between 1.1.0 M2 and the now released 1.1.0 GA

graemerocher commented 5 years ago

I have removed these old examples. If you wish to do create a new example use the CLI instead:

$ mn create-app myapp --features aws-api-gateway-graal
$ cd myapp 
$ mn create-controller foo
aarthisankaran commented 5 years ago

What version of the cli should I be using?

Thanks!

On Mon, Apr 15, 2019 at 11:18 AM Graeme Rocher notifications@github.com wrote:

I have removed these old examples. If you wish to do create a new example use the CLI instead:

$ mn create-app myapp --features aws-api-gateway-graal $ cd myapp $ mn create-controller foo

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_micronaut-2Dprojects_micronaut-2Daws_issues_26-23issuecomment-2D483295953&d=DwMCaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=qmkN6GP3iscA-Xvf8KNk3pYG5nvmYgtLv5Fcsz5By0w&m=COTktpGkngZuLPcnK0d1p4Y3iUukXDI4cX17xEA13f8&s=OuvVFI1IUdo_fPBzhlIhGx35Y9Zo7HJerqtl4Sboboc&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AB6LHDCCVMQC7RQFYVM6BMTPQSMFLANCNFSM4HFMSCEQ&d=DwMCaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=qmkN6GP3iscA-Xvf8KNk3pYG5nvmYgtLv5Fcsz5By0w&m=COTktpGkngZuLPcnK0d1p4Y3iUukXDI4cX17xEA13f8&s=kLABAXEFvP2H4ehBF48kIdSWp7b_xuL_63abZCXWrnY&e= .


The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

graemerocher commented 5 years ago

Using 1.1.0

aarthisankaran commented 5 years ago

It works!!! One last question as I am working on proving that we should start using micronaut for serverless microservices.

Should I use lambda FunctionBean or should I be using controller? There will be several GET/POST method etc.

On Mon, Apr 15, 2019 at 12:25 PM Graeme Rocher notifications@github.com wrote:

Using 1.1.0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_micronaut-2Dprojects_micronaut-2Daws_issues_26-23issuecomment-2D483322643&d=DwMCaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=qmkN6GP3iscA-Xvf8KNk3pYG5nvmYgtLv5Fcsz5By0w&m=qQk2TSR7_h7-_ZFcj_EUkO67BD2NVGWUwCAUVUewcTE&s=oB-Mt4RVfgLl5dWhWGCY0tyW3rJaD6mxboHCvpZVSW4&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AB6LHDEYJUBVOAMXRIOPGQDPQST6FANCNFSM4HFMSCEQ&d=DwMCaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=qmkN6GP3iscA-Xvf8KNk3pYG5nvmYgtLv5Fcsz5By0w&m=qQk2TSR7_h7-_ZFcj_EUkO67BD2NVGWUwCAUVUewcTE&s=sF-pDGQvXOKlXgcLSd6upvFzj3MzUrtJyZRyhk5Wj4g&e= .


The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

graemerocher commented 5 years ago

If your intention is to use GraalVM then you don't have much choice and only the API gateway / controller approach works because it is based on the Lambda custom runtime API

aarthisankaran commented 5 years ago

We have to use our internal gateway at Capital One. We have a place for transformation which I am trying to get details on how the custom payload for Lambda will look like.

I see that the micronaut lambda handler takes "path", "httpMethod" when I tried hitting the payload. Where can I get a full list, and if it has to be "method" instead of "httpMethod", is it possible to override?

On Tue, Apr 16, 2019 at 2:15 AM Graeme Rocher notifications@github.com wrote:

If your intention is to use GraalVM then you don't have much choice and only the API gateway / controller approach works because it is based on the Lambda custom runtime API

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_micronaut-2Dprojects_micronaut-2Daws_issues_26-23issuecomment-2D483525498&d=DwMCaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=qmkN6GP3iscA-Xvf8KNk3pYG5nvmYgtLv5Fcsz5By0w&m=QZ8p6lhEWMHTs5Ydw_Mmz_uoT3pct3_tC9J0b25nIk4&s=pe4rsT1NFmhGXJXmyVt4SBmxfs1ZtkCyrhVh-6uH1n0&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AB6LHDELCMFSVM5HSBGXD3DPQVVG5ANCNFSM4HFMSCEQ&d=DwMCaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=qmkN6GP3iscA-Xvf8KNk3pYG5nvmYgtLv5Fcsz5By0w&m=QZ8p6lhEWMHTs5Ydw_Mmz_uoT3pct3_tC9J0b25nIk4&s=YPtLJ45hS406YtXOmn650CjiRrDdwDCjT16hRz7O2d0&e= .


The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

aarthisankaran commented 5 years ago

@graemerocher when you have a moment can you respond to this query

graemerocher commented 5 years ago

@aarthisankaran sorry for the late reply. I have been away. Micronaut uses Amazon's standard serverless Java container support. The model of the payload is defined here https://github.com/awslabs/aws-serverless-java-container/tree/master/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model

For the request https://github.com/awslabs/aws-serverless-java-container/blob/master/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model/AwsProxyRequest.java is used for example.

I hope that answers your question.

athkalia commented 3 years ago

May help future readers:

I was getting the same error with a non-native GraalVM app because I forgot to add the

shadowJar {
    mergeServiceFiles()
}

ShadowJar Gradle plugin configuration in my build.gradle file.