Fork me on GitHub
Volodymyr Vizovskyy16:04:11

Hey, everyone! it's me again 😅 After a bunch of "--initialize-at-build-time=javax"-like blacklisting - my project seems to be building properly. However, if I try to run the jar in openjdk:latest - it complains about the missing runtime.

$ docker run -v $PWD:/tmp -it openjdk:latest /bin/bash
bash-4.4# cd /tmp
bash-4.4# java -jar .holy-lambda/build/output.jar  "my-ns.ExampleLambda"
What I get is:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.toString()" because "runtime" is null
Am I missing something?

Karol Wójcik19:04:23

Yeah. You cannot run the lambda from jar. The reason for this is your environment is not AWS Lambda Runtime.

Karol Wójcik19:04:33

You can either emulate the runtime via sam local or deploy the lambda on real environment.

Karol Wójcik19:04:17

Btw, why do you create a native artifact if you’re using Java runtime?

Volodymyr Vizovskyy07:04:44

Ohhhhh, right 😅 the execution must be tested with sam local invoke ExampleLambdaFunction! my bad, now it runs. As for the Java runtime - I used it for testing purposes because I can not run dynamically compiled binaries on my NixOS installation. For some reason, there's a Dockerfile with openjdk:latest as its base in the native project. Thanks for the help 😅

Karol Wójcik07:04:37

But the dynamically compiled binaries are run via sam local invoke, so it should work even on NIX.

Volodymyr Vizovskyy07:04:52

In fact, it does 🙂

Karol Wójcik07:04:51

Yeah. Dockerfile is only for Java. Anyway I’m revamping the layers support so soon it should be much easier to use HL with Java.

🙌 1