Fork me on GitHub
#holy-lambda
<
2022-03-20
>
Norman Kabir17:03:05

Hi Karol. I'm trying to repeat building the native ring adapter project here: https://github.com/FieryCod/holy-lambda-ring-adapter/tree/master/examples/native I have a fresh checkout on Ubuntu 20.04 and run: bb hl:clean && bb hl:compile producing

[holy-lambda] Command <hl:clean>
[holy-lambda] Cleaning build artifacts:

 - .holy-lambda
 - .cpcache
 - node_modules

[holy-lambda] Build artifacts cleaned
[holy-lambda] Command <hl:compile>
Compiling example.lambda ...
Building uber jar: .holy-lambda/build/output.jar
[holy-lambda] Uberjar artifact of the project is available at .holy-lambda/build/output.jar
Followed by bb hl:native:conf Producing
[holy-lambda] Command <hl:native:conf>
[holy-lambda] Compiling with agent support!
Compiling example.lambda ...
Building uber jar: .holy-lambda/build/output.jar
[holy-lambda] Generating traces to ignore unnecessary reflection entries!
[holy-lambda] Succesfully called all the lambdas
[holy-lambda] Generating native-configurations!
[holy-lambda] Succesfully called all the lambdas
[holy-lambda] Cleaning up reflection-config.json!
[holy-lambda] Cleaning up resource-config.json!
Followed by bb hl:native:executable Producing
[holy-lambda] Command <hl:native:executable>
Warning: Ignoring server-mode native-image argument --no-server.
[holy-lambda] Bundling artifacts...
/home/nkabir/labkey/bench/xpkg/rkx/unstable/rklambdaclj/vendor/holy-lambda-ring-adapter/examples/native/.holy-lambda/build
/home/nkabir/labkey/bench/xpkg/rkx/unstable/rklambdaclj/vendor/holy-lambda-ring-adapter/examples/native/.holy-lambda/build
/home/nkabir/labkey/bench/xpkg/rkx/unstable/rklambdaclj/vendor/holy-lambda-ring-adapter/examples/native/.holy-lambda/build
  adding: bootstrap (stored 0%)
  adding: output (deflated 72%)
[holy-lambda] Native artifact of the project is available at .holy-lambda/build/latest.zip
[holy-lambda] Binary: .holy-lambda/build/output
[holy-lambda] Bootstrap: .holy-lambda/build/bootstrap
If I run java -jar .holy-lambda/build/output.jar I receive the following error:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.toString()" because "runtime" is null
	at fierycod.holy_lambda.custom_runtime$url.invokeStatic(custom_runtime.clj:8)
	at fierycod.holy_lambda.custom_runtime$next_iter.invokeStatic(custom_runtime.clj:65)
	at fierycod.holy_lambda.custom_runtime$next_iter.invoke(custom_runtime.clj:61)
	at clojure.lang.Var.invoke(Var.java:393)
	at example.lambda$_main.invokeStatic(lambda.clj:12)
	at example.lambda$_main.doInvoke(lambda.clj:12)
	at clojure.lang.RestFn.invoke(RestFn.java:397)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at example.lambda.main(Unknown Source)
And when I try to test the executable: sam local invoke ExampleLambdaFunction I also get an error:
Invoking example.lambda.HttpAPIProxyGateway (provided.al2)
Decompressing /home/nkabir/labkey/bench/xpkg/rkx/unstable/rklambdaclj/vendor/holy-lambda-ring-adapter/examples/native/.holy-lambda/build/latest.zip
Skip pulling image and use local one: public.ecr.aws/sam/emulation-provided.al2:rapid-1.40.1-x86_64.

Mounting /tmp/tmpj9j4wexn as /var/task:ro,delegated inside runtime container
START RequestId: d689901d-1c75-46a0-a23d-07359edbf454 Version: $LATEST
[holy-lambda] Runtime error:
{:via [{:type java.lang.NullPointerException, :at [fierycod.holy_lambda_ring_adapter.core$hl_request__GT_ring_request invokeStatic "core.cljc" 34]}], :trace [[fierycod.holy_lambda_ring_adapter.core$hl_request__GT_ring_request invokeStatic "core.cljc" 34] [fierycod.holy_lambda_ring_adapter.core$hl_request__GT_ring_request_BANG__BANG_ invokeStatic "core.cljc" 53] [fierycod.holy_lambda_ring_adapter.core$ring_LT___GT_hl_middleware$fn__10456 invoke "core.cljc" 138] [clojure.lang.Var invoke "Var.java" 384] [fierycod.holy_lambda.custom_runtime$next_iter invokeStatic "custom_runtime.clj" 85] [fierycod.holy_lambda.custom_runtime$next_iter invoke "custom_runtime.clj" 61] [clojure.lang.Var invoke "Var.java" 393] [example.lambda$_main invokeStatic "lambda.clj" 12] [example.lambda$_main doInvoke "lambda.clj" 12] [clojure.lang.RestFn invoke "RestFn.java" 397] [clojure.lang.AFn applyToHelper "AFn.java" 152] [clojure.lang.RestFn applyTo "RestFn.java" 132] [example.lambda main nil -1]]}
END RequestId: d689901d-1c75-46a0-a23d-07359edbf454
REPORT RequestId: d689901d-1c75-46a0-a23d-07359edbf454	Init Duration: 0.11 ms	Duration: 9.36 ms	Billed Duration: 10 ms	Memory Size: 512 MB	Max Memory Used: 512 MB	
{"statusCode":500,"headers":{"content-type":"application/json"},"body":"{\"runtime-error\":true,\"err\":{\"via\":[{\"type\":\"java.lang.NullPointerException\",\"at\":[\"fierycod.holy_lambda_ring_adapter.core$hl_request__GT_ring_request\",\"invokeStatic\",\"core.cljc\",34]}],\"trace\":[[\"fierycod.holy_lambda_ring_adapter.core$hl_request__GT_ring_request\",\"invokeStatic\",\"core.cljc\",34],[\"fierycod.holy_lambda_ring_adapter.core$hl_request__GT_ring_request_BANG__BANG_\",\"invokeStatic\",\"core.cljc\",53],[\"fierycod.holy_lambda_ring_adapter.core$ring_LT___GT_hl_middleware$fn__10456\",\"invoke\",\"core.cljc\",138],[\"clojure.lang.Var\",\"invoke\",\"Var.java\",384],[\"fierycod.holy_lambda.custom_runtime$next_iter\",\"invokeStatic\",\"custom_runtime.clj\",85],[\"fierycod.holy_lambda.custom_runtime$next_iter\",\"invoke\",\"custom_runtime.clj\",61],[\"clojure.lang.Var\",\"invoke\",\"Var.java\",393],[\"example.lambda$_main\",\"invokeStatic\",\"lambda.clj\",12],[\"example.lambda$_main\",\"doInvoke\",\"lambda.clj\",12],[\"clojure.lang.RestFn\",\"invoke\",\"RestFn.java\",397],[\"clojure.lang.AFn\",\"applyToHelper\",\"AFn.java\",152],[\"clojure.lang.RestFn\",\"applyTo\",\"RestFn.java\",132],[\"example.lambda\",\"main\",null,-1]]}}"}
Any suggestions? I must be missing something very basic ;-)

Karol Wójcik19:03:49

You are trying to run a Lambda with the event that is not an AWS API event. Start your api with sam local start api

Norman Kabir19:03:04

That was it! Thank you!