This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-14
Channels
- # aleph (3)
- # announcements (1)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (62)
- # biff (2)
- # calva (13)
- # cider (4)
- # clj-kondo (6)
- # cljdoc (17)
- # clojure (142)
- # clojure-dev (6)
- # clojure-europe (62)
- # clojurescript (20)
- # core-async (26)
- # cursive (18)
- # data-oriented-programming (9)
- # data-science (1)
- # datahike (18)
- # events (4)
- # fulcro (4)
- # graalvm (2)
- # hyperfiddle (15)
- # interop (1)
- # jobs-discuss (8)
- # leiningen (2)
- # lsp (91)
- # malli (1)
- # missionary (11)
- # nbb (65)
- # off-topic (50)
- # practicalli (2)
- # programming-beginners (4)
- # re-frame (18)
- # remote-jobs (1)
- # shadow-cljs (53)
- # spacemacs (1)
- # specter (2)
- # sql (17)
- # tools-build (63)
- # web-security (1)
- # xtdb (15)
Oh hi. I'm new to nbb
and wanted to try out the malli example last night but had some difficulties. Going back to the announcement Tweet it was... gone π
I tried the initial example and then thought I'd try to use malli directly using the jar-workaround to use malli directly, but that's not working either and leaves me with :
----- Error --------------------------------------
Type: TypeError
Message: $APP.q is not a constructor
$APP.q is not a constructor
I can't figure out if I'm just being a noob, whether it's an actual issue or whether it's temporarily retracted.Hey @U1M0BC7S7 - I noticed you liked that tweet and then I realized I should have taken it down. malli was for a brief moment part of nbb as an optional dependency, but I had troubles deploying both npm libs at the same time so I had to revert it unfortunately for now
A right, I thought it might be something like that π Thank you for confirming @U04V15CAJ I'll happily try again at a more opportune moment.
@U1M0BC7S7 #babashka now does work with malli though - do you need malli specifically for something Node.js related?
I'm trying to convert an HTTP response checker from Clojure to nbb. I wrote it when I had no spec/malli knowledge and it runs in an always-on JVM process, so now I'm trying to convert it to a Serverless (AWS Lambda) model and also porting it to node/nbb for efficiency. I've done the footwork in #babashka but my skills for getting babashka to work in Lambda is not all there yet.
π― Ooh, I'm going to have a look at those. Thank you!
Yuuuuusss! got blambda going. Thanks for the pointer!
Nice! @U054AT6KT will be happy to hear this
What I've done a little differently is to create the resources via a CloudFormation template, which removes the need to keep track of the layer, role and policy ARNs while wiring it all up. Maybe not everyone's cup of tea, but it does make wiring up and tearing down the resources much easier π I need some π€ Thanks again for your help π
@U1M0BC7S7 Cool. It'd be cool if you shared your findings somewhere sometime and then we could link to it from https://github.com/babashka/babashka/wiki/AWS!
@U04V15CAJ sure π It's still a WIP, busy refactoring and clearing up things for a proposal: https://github.com/johanmynhardt/blambda/tree/cloudformation-poc/cfn In hindsight this looks like a lot more work, but once cleaned up I figure it would provide sleek layer + function management if abstracted away behind tasks. Need to get to actual work for today now.
@U1M0BC7S7 This is exactly what I had in mind. The lambda I'm working on uses Terraform instead of CloudFormation, but same basic idea. bb deploy
was really only meant for getting started quickly. Iβll add TF and CF examples to the docs when I have time. π
@U054AT6KT I stumbled across your Dogfooding Blambda! : revenge of the pod people post π
I tried to zip up a pod layer's content along with the runtime, and the bootstrap
script has the BABASHKA_PODS_DIR
set. In addition, the environment definitely has it set to /opt/.babashka/pods
. Somehow I still get the error from your post where it's looking in some home folder.
:cause /home/sbx_user1051/.babashka/pods/repository/org.babashka/aws/0.1.2/manifest.edn (No such file or directory)
From (System/getenv)
I get "BABASHKA_PODS_DIR" "/opt/.babashka/pods"
.
So now I'm not sure whether it's because I package it alongside the runtime or whether there's something else that I overlooked.I seem to remember @U04V15CAJ saying that there was a bug with BABASHKA_PODS_DIR
in some version of bb. Maybe try upgrading to the latest version, if it's not already?
yeah, you can use the latest master version from here: https://github.com/babashka/babashka-dev-builds
π Thank you, going to try that now.
@U1M0BC7S7 If you want to open a PR for Blambda to use this version, Iβll happily merge it. π
OK, I'll have to add a change to support snapshot installs, the release URL is a bit different, I manually pulled and repackaged π Can only have a look again tonight.
No hurry at all, and this is definitely an βonly if you want toβ sorta thing. π
π I do want to. My OSS contributions are few and I'd like to change that.
Where does it say sub millisecond startup time? I can't find it and don't remember writing that
> β’ Blazingly fast starts: sub-millisecond. AWS provisioning latency is your only overhead, so no worse than any other language and better than many.
π The "no compromises" line was my fault Michiel. Writing pithy and intriguing blog subtitles is hard π
No worries, just wanted to take away that expectation before people came complaining to me ;)
"I had to compromise dammit!" π₯
So, I tried to include schema and malli as optional dependencies but package them in a different npm package which you can optionally load. This sometimes worked and sometimes didn't. Npm publish failed for non-obvious reasons, as you can see here: https://github.com/babashka/nbb/commits/main?after=da04c12f88dacfbecaefda5b5e5bcb3fbd7a6ccb+69&branch=main&qualified_name=refs%2Fheads%2Fmain Because I had problems with this, I reverted it, but at some point I'd like to pick up on this idea again and at least support malli as a built-in but optional library. If anyone's got expertise with this, please chime in. Why do I want to push different modules to a different npm package? Because the baseline package should not become too big (just for sanity, but also the 3mb editing limit on AWS).
To be specific, the error that happened was:
npm ERR! code E404
npm ERR! 404 Not Found - PUT - Not found
npm ERR! 404
npm ERR! 404 '@babashka/[email protected]' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!
while @babashka/nbb-prismatic-schema
was in fact already publishedIf the artifact was published correctly but the npm registry is responding incorrectly, maybe https://www.npmjs.com/support can handle a bug report?
An alternative to this would be to upload the artifacts to Github releases and let nbb pull them from there
Since they are standalone, it should not be more complicated than just downloading them to a predicable location
Not sure what version it stopped working at. The above link to 0.5.112 does show as published on https://www.npmjs.com/package/@babashka/nbb-prismatic-schema
however, 114 seems to be missing here for malli: https://www.npmjs.com/package/@babashka/nbb-metosin-malli
As you can see here, nbb + metosin malli succeeded here: https://app.circleci.com/pipelines/github/babashka/nbb/710/workflows/352ed3f3-3269-4c9d-a84b-258acfdea90f/jobs/634 but then at the end, schema failed
oh, it seems the version was wrong too:
npm ERR! 404 '@babashka/[email protected]' is not in the npm registry.
If someone can experiment with a setup like this, please let me know and I'll revisit
Hmm, maybe uploading the files to github releases first is good, and then I can retry the publish locally as well
Hey, I have an issue with nbb execution:
Let's say I have a function called put-graphql
and internally, it loads a token from a file:
(defn put-graphql
"Put a GraphQL document"
[opts]
(let [{access-token "access_token"} (load-token)]
...))
but if I call it like
(put-graphql {})
and run from terminal:
./script
it returns:
----- Error --------------------------------------
Message: da.call is not a function
----- Context ------------------------------------
100:
101: (defn put-graphql
102: "Put a GraphQL document"
103: [opts]
104: (let [{access-token "access_token"} (load-token)
^--- da.call is not a function
da.call is not a function
Does anybody recognize what might be wrong? I was tweaking a little with p/let
but have no idea where the problem comes from. Forgive me my lack of JS knowledgeWithout any more context, I don't know what's wrong. What does load-token look like?
like this:
(def load-token
(let [token (-> os
.homedir
(str "/access-token.json")
fs/readFileSync
js/JSON.parse
(js->clj :keywordize-keys true)
:access_token)]
(if token
token
(prn "Please get a new access-token to proceed"))))
hey, I have similar issue with a.replace is not a function
. Consider following snippet:
(cond-> (fs/readFileSync "resources.edn")
:always (clojure.string/replace "{{base-uri}}" " "))
This time clojure.string/replace
is a function, right?