Fork me on GitHub
#babashka
<
2021-10-18
>
Mno11:10:25

just in case you find this amusing, I made a script repo and small runner for (mostly bb) scripts in our company and made a fun logo for it.

ā¤ļø 2
šŸ„§ 2
Mno11:10:58

any similiarities between this one and the original bb logo are pure coincidence šŸ˜‰

borkdude11:10:52

Oh that looks awesome :)

borkdude11:10:32

If the company you're working for wants to mention it here, that'd be cool https://github.com/babashka/babashka/discussions/1026

borkdude11:10:02

@UGFL22X0Q Btw, I'm still looking for a logo for #nbb. It seems you have talent...

Mno11:10:31

hahah I can give it a try, if you have any ideas. šŸ™‚

borkdude11:10:58

Something like this but perhaps something JS / node related in it?

Mno11:10:28

too subtle?

Mno11:10:52

I could add the JS to the glasses?

borkdude11:10:18

maybe a green scarve?

borkdude11:10:26

like node's color

Mno11:10:07

I couldn't make the same subtle gradient it normally has

borkdude11:10:48

That's ok, it might be better to have less details

borkdude11:10:32

and now instead of the lambda terminal, we can do something different

borkdude11:10:13

but this is already cool!

Mno12:10:28

šŸŽ‰

Michael W16:10:21

perhaps {JS}_ for the prompt?

cap10morgan20:10:32

I'm trying to pull in the aws-api libraries but having some trouble. when I use the babashka pod, I can start up a REPL and things work in there, but then when I try to build an uberscript bb -m my.main.ns --uberscript target/uber.clj I get Could not find namespace: pod.babashka.aws. But when I add the regular clojure libraries to my bb.edn file, I get a similar error in my REPL (haven't tried building the uberscript that way, though).

cap10morgan20:10:46

do I need to add the pod to my bb.edn deps or something?

borkdude20:10:57

Unfortunately uberscript doesn't work very well with pods right now since their namespaces are introduced in a special manner. Feel free to post an issue about this. I think namespaces starting with pod should be ignored by the uberscript logic.

borkdude20:10:00

As an alternative you might be able to use the uberjar facility instead. It produces an uberjar that bb can run

borkdude20:10:32

About the REPL: you should first run load-pod before you can use the pod.babashka.aws namespace. You don't need to bring in the aws-api libraries. Everything necessary is contained in the pod.

cap10morgan20:10:19

If I'm already using a project w/ bb.edn , deps.edn , etc. would it be easier to just bring in the libs instead of using the pod?

borkdude20:10:12

the libs unfortunately don't work from source with bb

cap10morgan20:10:54

ok, cool. that gives me some more options and cuts off some dead ends, so thanks!

borkdude20:10:12

Not sure if relevant

cap10morgan20:10:22

oh nice, very relevant! I'm also working in AWS lambda

cap10morgan20:10:34

hmm... the uberjar is saying "could not resolve symbol aws/client." part of my confusion might stem from the fact that I'm using -main entrypoints rather than shebangs so maybe I'm not translating the examples quite right.

borkdude20:10:36

@U06FS3DLH do you have a require like this?

(require '[pod.babashka.aws :as aws])

cap10morgan20:10:49

yes, in my -main fn

borkdude20:10:10

that doesn't work, this needs to be on the top level

borkdude20:10:48

This is called the gilardi scenario: https://technomancy.us/143

borkdude20:10:12

In Clojure you cannot introduce new aliases in a function and use them from that function, this is the problem

cap10morgan20:10:29

was having some other issues w/ that, but that was likely before I tried building an uberjar

borkdude20:10:04

It is because the reader reads the entire top level form and already needs to know the alias by then

borkdude20:10:02

you can however use (resolve 'pod.babashka.aws/client)

borkdude20:10:21

if you want to delay loading the pod to the main function

cap10morgan20:10:28

got it working! thank you!

borkdude20:10:36

but I don't think there is a reason you should be doing that. OK cool

cap10morgan21:10:46

are there some docs on pre-downloading the pod and bundling it? seems to be re-downloading on every invocation of the lambda

borkdude21:10:44

@U06FS3DLH holy lambda can take care of this. the gist of this is that you need to download them during the build of your container already

borkdude21:10:32

pods are saved in ~/.babashka/pods

cap10morgan21:10:37

ok, yeah. found that after I had a basic structure put together from a different example. I figured I'd probably find a reason to migrate to that sooner or later šŸ™‚

borkdude21:10:50

but holy lambda already supports this with some custom logic

šŸ‘ 1
borkdude21:10:19

the gist of it is that you need to make sure the file is in the expected location already when the image starts

borkdude08:10:23

@U06FS3DLH I forgot to mention. You can also manually download the pod you're using and then do (pods/load-pod "./the-pod-you-downloaded")

šŸ‘ 1
borkdude08:10:27

if that makes things easier

cap10morgan15:10:28

hmm... when I write a simple shebang script like the example (to pre-download the pods), I get this:

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: pods/load-pods
Location: /Users/wmorgan/./download_pods.clj:5:2
Phase:    analysis

----- Context ------------------------------------------------------------------
1: #!/usr/bin/env bb
2:
3: (require '[babashka.pods :as pods])
4:
5: (pods/load-pods 'org.babashka/aws "0.0.6")
    ^--- Could not resolve symbol: pods/load-pods

borkdude15:10:57

load-pod singular

cap10morgan15:10:45

d'oh! re-read that more times than I want to admit. thanks! šŸ™‚

cap10morgan21:10:09

when loading a pod w/ the string path variant you mentioned above, does the path need to point at the dir w/ the manifest.edn and executable? or right at the executable?

borkdude21:10:52

right at the executable

borkdude21:10:02

you don't use the registry / manifest at all when doing so

cap10morgan21:10:39

do those follow a standard naming convention from the pod name? e.g. org.babashka/aws -> pod-babashka-aws

borkdude21:10:17

usually yes

borkdude21:10:55

but you can just inspect that name after unzipping of course

borkdude21:10:52

e.g. the clj-kondo and datalevin pods don't follow this convention since they are standalone CLI tools that can also be invoked as pods

šŸ‘ 1
ghosttoaster20:10:55

Hey all. Iā€™m trying to run nbb on node 12.0.0 but I keep getting errors on the import statement:

import { $APP, shadow$provide, $jscomp } from "./nbb_api.js";
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
    at internal/main/run_main_module.js:17:11

borkdude20:10:46

you need a newer node version, try the latest 12 or preferably 14 or 16

ghosttoaster20:10:00

ah. Got it thanks.

borkdude20:10:04

The early 12 version can't deal with ES modules

borkdude20:10:19

There is also an #nbb channel, we can continue there

ghosttoaster20:10:26

I think I can upgrade. Gonna try and make it happen. Thanks so much!

šŸ‘ 1