-
Notifications
You must be signed in to change notification settings - Fork 14
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
zio-lambda-example cannot find main class zio.lambda.example.SimpleHandler$ #213
Comments
@Isaacwhyuenac I can't remember what exactly was wrong, but I remember I spent a significant amount of time trying to figure out how to deploy it to aws properly. |
Thx @heaven-born for the quick reply. On my side, the same error persists even though I build the jar/zip with corretto64-11.0.19 on osx Apple silicon. timestamp=2023-07-01T18:10:00.715Z level=ERROR thread=#zio-fiber-0 message="" cause="Exception in thread "zio-fiber-4" java.lang.ClassNotFoundException: zio.lambda.example.SimpleHandler$
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at zio.lambda.internal.LambdaLoaderLiveCommon.$anonfun$loadLambda$2(LambdaLoaderLive.scala:29)
at zio.ZIOCompanionVersionSpecific.$anonfun$attempt$1(ZIOCompanionVersionSpecific.scala:100)
at zio.lambda.internal.ZLambdaAppReflective.run(ZLambdaAppReflective.scala:15)
at zio.lambda.internal.ZLambdaAppReflective.run(ZLambdaAppReflective.scala:16)
at zio.lambda.internal.ZLambdaAppReflective.run(ZLambdaAppReflective.scala:25)"
START RequestId: ccf3ed13-072f-4ead-92f0-7bbc937f6844 Version: $LATEST
2023-07-01T18:10:03.950Z ccf3ed13-072f-4ead-92f0-7bbc937f6844 Task timed out after 3.11 seconds
END RequestId: ccf3ed13-072f-4ead-92f0-7bbc937f6844
REPORT RequestId: ccf3ed13-072f-4ead-92f0-7bbc937f6844 Duration: 3110.90 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 20 MB |
@Isaacwhyuenac did you follow the steps this way #197 (comment) ?
|
Thx @heaven-born Yes, I follow it. 😢 I renamed the .jar to .zip to bypass github file extension restriction.... == zio-lambda-example.jar |
Can't unzip your zio-lambda-example.jar for some reason to check the content, but let me ask something. And in my case the "compatible runtime" was "provided" instead of java11. |
The layer is basically your function, you should not provide separate code for the function. |
No, I have only working project configured to be compiled using graalvm. The is no need in layers in this case. I remember I was also confused about the code separation, but as I remember this is how I managed to make it works. I needed this working only to test my PR, so not much memory about this issue left in my head. Maybe the way I made is working is not canonical way or I forgot something, but what I can remember is that there must be only the layer. However, I don’t understand why your universal package doesn’t contain this jar. I will try to reproduce it today if I have some extra time. |
the universal package under But I would also love to know the canonical way of doing this. |
Confirmed the universal package under lambda-example contains the example jar, but it is not working. Confirm the graalvm approach does work.
Maybe we need the input from @jrmsamson as I followed his approach #197 (comment) to test the non-graalvm and not working. His screenshots do look working perfectly with sbt "zio-lambda / universal:packageBin"
sbt "zio-lambda-example / assembly" |
I can give you my working example of the layer that I downloaded from the aws. If you deploy it and run a test using this json it will work: {
"message": "value1"
} Unfortunately, I don't remember how I made it. But it was something to do with |
there is a good chance that I manually added the class |
Hi @Isaacwhyuenac @heaven-born, First of all apologies for the lack of documentation. I'm aware that It can be confusing but I'll try to document this to make it easier for new users to start using zio-lambda. What I normally do to start using zio-lambda as a layer is I go to the root of the project and run the following to generate the zip that needs to be uploaded to AWS to create the layer. (My intention is to include it in the README so people can just download it without running this)
This is the file that got generated from the last version zio-lambda-1.0.4.zip Afterwards, with the help of
The only thing left is to upload your lambda function implemented with zio-lambda and select the custom layer you just uploaded. You can use this to test the layer. zio-lambda-example.zip (Edit: I just tested it and it works fine for me) |
resolved Thx @jrmsamson @heaven-born |
Hi I managed to upload zio-lambda as layer but I cannot manage to get the zio-lambda-example running. I am using the current master branch of the repo to do the testing.
I am having the following error.
I saw in a separate issue from @heaven-born that similar issue has arisen and have successfully resolved the issue. May I get help from you guys?...
ZLambdaAppReflective
is now switched to the new app structure, so If you build withuniversal:packageBin
the new approach will be used.Originally posted by @heaven-born in #197 (comment)
The text was updated successfully, but these errors were encountered: