This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-05
Channels
- # announcements (1)
- # asami (21)
- # aws (19)
- # babashka (37)
- # beginners (38)
- # clj-kondo (7)
- # clj-otel (8)
- # clojure (29)
- # clojure-europe (54)
- # clojure-nl (3)
- # clojure-spec (2)
- # clojure-uk (2)
- # clojurescript (15)
- # conjure (1)
- # data-science (1)
- # datomic (21)
- # emacs (6)
- # events (3)
- # figwheel-main (1)
- # gratitude (13)
- # holy-lambda (11)
- # joyride (6)
- # klipse (3)
- # malli (14)
- # missionary (26)
- # nbb (31)
- # omni-trace (2)
- # pathom (3)
- # reagent (1)
- # reitit (1)
- # releases (1)
- # shadow-cljs (24)
- # sql (27)
- # tools-deps (4)
- # vim (21)
I'm assuming this is working atm as I'm getting a NullPointerException
on sam invoke
?
https://github.com/FieryCod/holy-lambda-ring-adapter
AWS_PROFILE=example-queue-user sam local invoke ExampleAWSFnFunction
Invoking example-aws-fn.core.ExampleAWSFnFunction (provided.al2)
arn:aws:lambda:eu-west-2:850264420474:layer:holy-lambda-babashka-runtime-amd64:1 is already cached. Skipping download
BabashkaDepsLayer is a local Layer in the template
Building image............................
Skip pulling image and use local one: samcli/lambda:provided.al2-x86_64-056ccc8ca5cd60f02c36d2c60.
Mounting /Users/folcon/Documents/Code/example-aws-fn/src as /var/task:ro,delegated inside runtime container
START RequestId: 135de413-03a0-4e26-9307-6dcff3939887 Version: $LATEST
Downloading pod org.babashka/aws (0.1.2)
Successfully installed pod org.babashka/aws (0.1.2)
[holy-lambda] Runtime error:
{:via [{:type java.lang.NullPointerException, :at [sci.impl.analyzer$return_binding_call$fn__8865 invoke "analyzer.cljc" 1005]}], :trace [[sci.impl.analyzer$return_binding_call$fn__8865 invoke "analyzer.cljc" 1005] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.evaluator$eval invoke "evaluator.cljc" 329] [sci.impl.evaluator$eval_let$fn__7021 invoke "evaluator.cljc" 64] [sci.impl.evaluator$eval_let invokeStatic "evaluator.cljc" 57] [sci.impl.analyzer$analyze_let_STAR_$fn__8652 invoke "analyzer.cljc" 421] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.evaluator$eval invoke "evaluator.cljc" 329] [sci.impl.evaluator$eval_let invokeStatic "evaluator.cljc" 73] [sci.impl.analyzer$analyze_let_STAR_$fn__8652 invoke "analyzer.cljc" 421] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.fns$fun$arity_1__7325 invoke "fns.cljc" 156] [sci.impl.vars.SciVar invoke "vars.cljc" 325] [sci.impl.analyzer$return_call$fn__8985 invoke "analyzer.cljc" 1076] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_do$fn__8041 invoke "analyzer.cljc" 135] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.fns$fun$arity_1__7325 invoke "fns.cljc" 156] [sci.impl.vars.SciVar invoke "vars.cljc" 325] [sci.impl.analyzer$return_call$fn__8985 invoke "analyzer.cljc" 1076] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_binding_call$fn__8865 invoke "analyzer.cljc" 1005] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_call$fn__8985 invoke "analyzer.cljc" 1076] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.fns$fun$arity_1__7325 invoke "fns.cljc" 156] [clojure.lang.AFn applyToHelper "AFn.java" 154] [clojure.lang.AFn applyTo "AFn.java" 144] [clojure.core$apply invokeStatic "core.clj" 667] [sci.impl.fns$eval_fn$fn__7827 doInvoke "fns.cljc" 268] [clojure.lang.RestFn invoke "RestFn.java" 408] [sci.impl.vars.SciVar invoke "vars.cljc" 325] [sci.impl.analyzer$return_binding_call$fn__8865 invoke "analyzer.cljc" 1005] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_call$fn__8997 invoke "analyzer.cljc" 1076] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.evaluator$eval invoke "evaluator.cljc" 329] [sci.impl.evaluator$eval_try invokeStatic "evaluator.cljc" 144] [sci.impl.analyzer$analyze_try$fn__8731 invoke "analyzer.cljc" 648] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_if$fn__8695 invoke "analyzer.cljc" 545] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_do$fn__8043 invoke "analyzer.cljc" 135] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.evaluator$eval invoke "evaluator.cljc" 329] [sci.impl.evaluator$eval_let invokeStatic "evaluator.cljc" 73] [sci.impl.analyzer$analyze_let_STAR_$fn__8652 invoke "analyzer.cljc" 421] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.fns$fun$arity_4__7355 invoke "fns.cljc" 168] [sci.impl.vars.SciVar invoke "vars.cljc" 331] [sci.impl.evaluator$fn_call invokeStatic "evaluator.cljc" 327] [sci.impl.analyzer$analyze_call$fn__9082 invoke "analyzer.cljc" 1298] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_do$fn__8041 invoke "analyzer.cljc" 135] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.fns$fun$arity_0__7319 invoke "fns.cljc" 152] [sci.impl.evaluator$fn_call invokeStatic "evaluator.cljc" 327] [sci.impl.analyzer$analyze_call$fn__9082 invoke "analyzer.cljc" 1298] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.evaluator$eval invoke "evaluator.cljc" 329] [sci.impl.evaluator$eval_let invokeStatic "evaluator.cljc" 73] [sci.impl.analyzer$analyze_let_STAR_$fn__8652 invoke "analyzer.cljc" 421] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_if$fn__8697 invoke "analyzer.cljc" 558] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.analyzer$return_do$fn__8041 invoke "analyzer.cljc" 135] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.evaluator$eval invoke "evaluator.cljc" 329] [sci.impl.evaluator$eval_let invokeStatic "evaluator.cljc" 73] [sci.impl.analyzer$analyze_let_STAR_$fn__8652 invoke "analyzer.cljc" 421] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.fns$fun$varargs__7809 doInvoke "fns.cljc" 102] [clojure.lang.RestFn invoke "RestFn.java" 397] [clojure.lang.AFn applyToHelper "AFn.java" 152] [clojure.lang.RestFn applyTo "RestFn.java" 132] [clojure.core$apply invokeStatic "core.clj" 667] [clojure.core$apply invoke "core.clj" 662] [sci.impl.vars.SciVar invoke "vars.cljc" 327] [sci.impl.analyzer$return_call$fn__8989 invoke "analyzer.cljc" 1076] [sci.impl.evaluator$eval invokeStatic "evaluator.cljc" 335] [sci.impl.interpreter$eval_form invokeStatic "interpreter.cljc" 32] [sci.impl.interpreter$eval_string_STAR_ invokeStatic "interpreter.cljc" 47] [sci.core$eval_string_STAR_ invokeStatic "core.cljc" 236] [babashka.main$exec$fn__35008$fn__35009 invoke "main.clj" 869] [babashka.main$exec$fn__35008 invoke "main.clj" 869] [babashka.main$exec invokeStatic "main.clj" 859] [babashka.main$main invokeStatic "main.clj" 944] [babashka.main$main doInvoke "main.clj" 925] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.core$apply invokeStatic "core.clj" 667] [babashka.main$_main invokeStatic "main.clj" 977] [babashka.main$_main doInvoke "main.clj" 969] [clojure.lang.RestFn applyTo "RestFn.java" 137] [babashka.main main nil -1]]}
END RequestId: 135de413-03a0-4e26-9307-6dcff3939887
REPORT RequestId: 135de413-03a0-4e26-9307-6dcff3939887 Init Duration: 0.14 ms Duration: 3918.14 ms Billed Duration: 3919 ms Memory Size: 128 MB Max Memory Used: 128 MB
{"statusCode":500,"headers":{"content-type":"application/json"},"body":"{\"via\":[{\"type\":\"java.lang.NullPointerException\",\"at\":[\"sci.impl.analyzer$return_binding_call$fn__8865\",\"invoke\",\"analyzer.cljc\",1005]}],\"trace\":[[\"sci.impl.analyzer$return_binding_call$fn__8865\",\"invoke\",\"analyzer.cljc\",1005],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.evaluator$eval\",\"invoke\",\"evaluator.cljc\",329],[\"sci.impl.evaluator$eval_let$fn__7021\",\"invoke\",\"evaluator.cljc\",64],[\"sci.impl.evaluator$eval_let\",\"invokeStatic\",\"evaluator.cljc\",57],[\"sci.impl.analyzer$analyze_let_STAR_$fn__8652\",\"invoke\",\"analyzer.cljc\",421],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.evaluator$eval\",\"invoke\",\"evaluator.cljc\",329],[\"sci.impl.evaluator$eval_let\",\"invokeStatic\",\"evaluator.cljc\",73],[\"sci.impl.analyzer$analyze_let_STAR_$fn__8652\",\"invoke\",\"analyzer.cljc\",421],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.fns$fun$arity_1__7325\",\"invoke\",\"fns.cljc\",156],[\"sci.impl.vars.SciVar\",\"invoke\",\"vars.cljc\",325],[\"sci.impl.analyzer$return_call$fn__8985\",\"invoke\",\"analyzer.cljc\",1076],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_do$fn__8041\",\"invoke\",\"analyzer.cljc\",135],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.fns$fun$arity_1__7325\",\"invoke\",\"fns.cljc\",156],[\"sci.impl.vars.SciVar\",\"invoke\",\"vars.cljc\",325],[\"sci.impl.analyzer$return_call$fn__8985\",\"invoke\",\"analyzer.cljc\",1076],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_binding_call$fn__8865\",\"invoke\",\"analyzer.cljc\",1005],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_call$fn__8985\",\"invoke\",\"analyzer.cljc\",1076],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.fns$fun$arity_1__7325\",\"invoke\",\"fns.cljc\",156],[\"clojure.lang.AFn\",\"applyToHelper\",\"AFn.java\",154],[\"clojure.lang.AFn\",\"applyTo\",\"AFn.java\",144],[\"clojure.core$apply\",\"invokeStatic\",\"core.clj\",667],[\"sci.impl.fns$eval_fn$fn__7827\",\"doInvoke\",\"fns.cljc\",268],[\"clojure.lang.RestFn\",\"invoke\",\"RestFn.java\",408],[\"sci.impl.vars.SciVar\",\"invoke\",\"vars.cljc\",325],[\"sci.impl.analyzer$return_binding_call$fn__8865\",\"invoke\",\"analyzer.cljc\",1005],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_call$fn__8997\",\"invoke\",\"analyzer.cljc\",1076],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.evaluator$eval\",\"invoke\",\"evaluator.cljc\",329],[\"sci.impl.evaluator$eval_try\",\"invokeStatic\",\"evaluator.cljc\",144],[\"sci.impl.analyzer$analyze_try$fn__8731\",\"invoke\",\"analyzer.cljc\",648],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_if$fn__8695\",\"invoke\",\"analyzer.cljc\",545],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_do$fn__8043\",\"invoke\",\"analyzer.cljc\",135],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.evaluator$eval\",\"invoke\",\"evaluator.cljc\",329],[\"sci.impl.evaluator$eval_let\",\"invokeStatic\",\"evaluator.cljc\",73],[\"sci.impl.analyzer$analyze_let_STAR_$fn__8652\",\"invoke\",\"analyzer.cljc\",421],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.fns$fun$arity_4__7355\",\"invoke\",\"fns.cljc\",168],[\"sci.impl.vars.SciVar\",\"invoke\",\"vars.cljc\",331],[\"sci.impl.evaluator$fn_call\",\"invokeStatic\",\"evaluator.cljc\",327],[\"sci.impl.analyzer$analyze_call$fn__9082\",\"invoke\",\"analyzer.cljc\",1298],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_do$fn__8041\",\"invoke\",\"analyzer.cljc\",135],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.fns$fun$arity_0__7319\",\"invoke\",\"fns.cljc\",152],[\"sci.impl.evaluator$fn_call\",\"invokeStatic\",\"evaluator.cljc\",327],[\"sci.impl.analyzer$analyze_call$fn__9082\",\"invoke\",\"analyzer.cljc\",1298],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.evaluator$eval\",\"invoke\",\"evaluator.cljc\",329],[\"sci.impl.evaluator$eval_let\",\"invokeStatic\",\"evaluator.cljc\",73],[\"sci.impl.analyzer$analyze_let_STAR_$fn__8652\",\"invoke\",\"analyzer.cljc\",421],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_if$fn__8697\",\"invoke\",\"analyzer.cljc\",558],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.analyzer$return_do$fn__8041\",\"invoke\",\"analyzer.cljc\",135],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.evaluator$eval\",\"invoke\",\"evaluator.cljc\",329],[\"sci.impl.evaluator$eval_let\",\"invokeStatic\",\"evaluator.cljc\",73],[\"sci.impl.analyzer$analyze_let_STAR_$fn__8652\",\"invoke\",\"analyzer.cljc\",421],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.fns$fun$varargs__7809\",\"doInvoke\",\"fns.cljc\",102],[\"clojure.lang.RestFn\",\"invoke\",\"RestFn.java\",397],[\"clojure.lang.AFn\",\"applyToHelper\",\"AFn.java\",152],[\"clojure.lang.RestFn\",\"applyTo\",\"RestFn.java\",132],[\"clojure.core$apply\",\"invokeStatic\",\"core.clj\",667],[\"clojure.core$apply\",\"invoke\",\"core.clj\",662],[\"sci.impl.vars.SciVar\",\"invoke\",\"vars.cljc\",327],[\"sci.impl.analyzer$return_call$fn__8989\",\"invoke\",\"analyzer.cljc\",1076],[\"sci.impl.evaluator$eval\",\"invokeStatic\",\"evaluator.cljc\",335],[\"sci.impl.interpreter$eval_form\",\"invokeStatic\",\"interpreter.cljc\",32],[\"sci.impl.interpreter$eval_string_STAR_\",\"invokeStatic\",\"interpreter.cljc\",47],[\"sci.core$eval_string_STAR_\",\"invokeStatic\",\"core.cljc\",236],[\"babashka.main$exec$fn__35008$fn__35009\",\"invoke\",\"main.clj\",869],[\"babashka.main$exec$fn__35008\",\"invoke\",\"main.clj\",869],[\"babashka.main$exec\",\"invokeStatic\",\"main.clj\",859],[\"babashka.main$main\",\"invokeStatic\",\"main.clj\",944],[\"babashka.main$main\",\"doInvoke\",\"main.clj\",925],[\"clojure.lang.RestFn\",\"applyTo\",\"RestFn.java\",137],[\"clojure.core$apply\",\"invokeStatic\",\"core.clj\",667],[\"babashka.main$_main\",\"invokeStatic\",\"main.clj\",977],[\"babashka.main$_main\",\"doInvoke\",\"main.clj\",969],[\"clojure.lang.RestFn\",\"applyTo\",\"RestFn.java\",137],[\"babashka.main\",\"main\",null,-1]]}"}
Few things:
1. Why would you like to use adapter with babashka?
2. It looks like you're not having pods in a layer thus those are not cached.
3. You have to send an event to sam local invoke
otherwise the adapter throws an NPE. There is nothing to adapt if the event is nil
The 3. is the answer to your "question".
@U0JUM502E if you develop an API you should take a look into sam local start-api instead of invoke
@U0JUM502E I fixed the NPE in the newest release of an adapter https://github.com/FieryCod/holy-lambda-ring-adapter Now the adapter will throw a meaningful error.
https://clojurians.slack.com/archives/C01UQJ4JC9Y/p1657047047879439?thread_ts=1657046617.787199&cid=C01UQJ4JC9Y
Sorry, for different use cases I'm not sure what is the "expected" way to do stuff?
A lot of software seems to work really well if you stick to the expected paths when initially working with it. Once you know how it works, thats when I feel comfortable deviating.
Getting comfortable with holy-lambda
is made a little challenging as lots of different examples to things a bit differently and it's hard to work out why the differences are there, is it environmental eg.
> 1. Why would you like to use adapter with babashka?
So in this case I was trying to do route matching inside the lambda, as opposed to have api gateway do the matching and firing different lambdas. Finding match stuff made me believe that doing this route matching was appropriate. Though I was expecting to use compojure
or reitit
etc for example.
> 2. It looks like you're not having pods in a layer thus those are not cached.
I get that you need to put layers for fast pod performance, but at the moment I'm still fresh off of following a few tutorials so I'm really lacking context of how to do that / think through these things.
> 3, You have to send an event to sam local invoke otherwise the adapter throws an NPE. There is nothing to adapt if the event is nil
Ah, ok, I didn't spot any of the examples cover this so I had no idea.
> if you develop an API you should take a look into sam local start-api instead of invoke
I have been doing that a little, so it's good that I'm going the correct route with it.
Other sources of confusion:
• What for Runtime
what is the difference between provided.al2
vs provided
• My arn for my layer ends in layer:holy-lambda-babashka-runtime-amd64:1
, some of the examples end in babashka-runtime-amd64:63
or some other high version number, I'm assuming as we own the layers that's not significant, but do these layers update as we're managing them? Or do we need to update them somehow? I looked inside the console on the layer and couldn't see any obvious buttons etc that spoke to an update pathway or even what the original source of the layer was. Which is odd, we tell aws to copy a preexisting layer, it's annoying that they don't seem to track that in any way.
Hopefully this doesn't just come off as me complaining, the tooling is really impressive, these are just some of the sharp edges I've hit 😃...
Oh yes. There are examples that do things differently then it's written in documentation, because a lot of people were asking me whether HL can do "X" or "Y" or "Z". I'm in a process on making the documentation and examples more consistent. Nothing to sorry about 🙂
1. You are free to do whatever you want 🙂 Just it's first time, I'm seeing somebody using bb with the adapter. I also didn't know the compojure and reitit works with babashka, so I was surprised. If some routing library works with bb then go for it!
2. https://fierycod.github.io/holy-lambda/#/faq?id=can-i-use-hl-with-cdk-pulumi-terraform - you already have one layer that packs deps. Copy paste it in template.yml and change it's name + reference the correct path path where pods are stored 🙂
3. This is because I don't want to document other tools. I'm not a maintainer of AWS SAM. Btw, for sam local invoke
you should send the profile via --profile
flag. Consult sam local invoke --help
. Hmm, as I can see the documentation mentions sam local start-api
, but doesn't describes what it does. PR welcome 😄 (https://fierycod.github.io/holy-lambda/#/babashka-backend-tutorial?id=babashka-backend)
4. Runtime provided.al2
vs provided
- one runs on Amazon Linux v2 and other on Amazon Linux v1 - different version of glibc and some built in tooling etc.
When you deploy a layer the number :1
means it's now your layer with version :1
. When there is an update of a layer you can deploy a "new" layer by clicking the deploy button here https://serverlessrepo.aws.amazon.com/applications/eu-central-1/443526418261/holy-lambda-babashka-runtime-amd64. There is no automatic update of layers and believe me you don't want it to be automatic 😄
> There is no automatic update of layers and believe me you don't want it to be automatic 😄 Oh sure, but it would be good if I got notified somewhere, either in a dashboard or email or something that there's a new thing available. It's good to know there's an update path though 😃... > 2. https://fierycod.github.io/holy-lambda/#/faq?id=can-i-use-hl-with-cdk-pulumi-terraform - you already have one layer that packs deps. Copy paste it in template.yml and change it's name + reference the correct path path where pods are stored 🙂 Thanks for this, I'll have to have a read and try to do this!