Fork me on GitHub
#nbb
<
2022-10-31
>
ray21:10:07

We are seeing some errors finding deps when using nbb.edn on Lambdas

ray21:10:38

we have ensured that the contents of .nbb is populated and added to the zip

ray21:10:47

are other folders needed?

borkdude21:10:11

I don't think so but I think you should be able to reproduce that locally

borkdude21:10:27

did you also add the nbb.edn to the zip?

borkdude21:10:23

and the lambda is running the code from the directory where the nbb.edn is right?

borkdude21:10:55

should work (in theory) but reproducing locally to find out would be best

ray21:10:25

ok, just wanted to make sure I hadn't missed anything obvious

borkdude21:10:35

else https://github.com/babashka/nbb/tree/main/doc/bundle is still an option. This produces a single .mjs file where all .cljs is inlined into a single file, so no .nbb necessary

ray21:10:09

the project supports many lambdas

ray21:10:49

so I'm not sure that's viable

borkdude21:10:09

I can look more closely tomorrow if you find something

ray21:10:31

I'll check in the morning also - thanks!

ray08:11:37

$ node card-get.mjs 
file:///home/ray/fc/repos/card-main/node_modules/nbb/lib/nbb_core.js:2214
2,null),new $APP.G(null,jt,new $APP.G(null,new $APP.G(null,$APP.Ul,new $APP.G(null,D,null,1,null),2,null),null,1,null),2,null),3,null),4,null),5,null),6,null)):null}finally{$APP.Wq()}}).then(function(){var P=$APP.z(a);return hx.h?hx.h(P,b):hx.call(null,P,b)}):Promise.reject(Error(["Could not find namespace: ",$APP.p.g(q)].join("")))}return Promise.resolve($APP.U.g(b))};
                                                                                                                                                                                                                                                                                   ^

Error: Could not find namespace: camel-snake-kebab.core
    at hx (file:///home/ray/fc/repos/card-main/node_modules/nbb/lib/nbb_core.js:2214:276)
    at file:///home/ray/fc/repos/card-main/node_modules/nbb/lib/nbb_core.js:2214:244
    at async file:///home/ray/fc/repos/card-main/card-get.mjs:5:21

ray08:11:33

I tried with node 14 / 16 / 18 and got the same result

borkdude08:11:42

I’m not sure what I’m looking at

borkdude08:11:17

Can you make some kind of repro? Will be at kbd in an hour

ray08:11:04

Sure but can you confirm that is it supposed to "just work" directly with node?

borkdude08:11:38

It depends what you did. I have no clue with additional context?

ray08:11:59

ok, I'll try to make a small repro

borkdude09:11:41

ok, I'm back at kbd now

ray10:11:12

after npm install and npx nbb call node card-get.mjs

borkdude10:11:03

I think when going through the JS API, it doesn't add the .nbb stuff. You can fix this by adding addClassPath(".nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/nbb-deps") manually for now. Issue welcome

borkdude10:11:11

(I tested the above, it works)

borkdude10:11:31

why do you have the .mjs file here again?

borkdude10:11:39

oh yes, for AWS

1
borkdude10:11:31

next time you can also use getClassPath to print the current classpath, for debugging

ray10:11:42

is addClasspath in the card-get.mjs?

borkdude10:11:46

yes:

import { addClassPath, getClassPath, loadFile } from 'nbb';

addClassPath("src")
addClassPath(".nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/nbb-deps")

const { handler } = await loadFile('./src/card_get.cljs');

export { handler }

ray10:11:06

ok, I'll open an issue

borkdude10:11:53

I'll probably get to this tomorrow or Thursday

1
ray10:11:56

find .nbb -type d -name nbb-deps

ray11:11:52

and of course I have to write bash 🙂

borkdude11:11:43

You could do this as part of the .mjs script too ;)

ray11:11:13

I much prefer to write code like this

function patch() {
    sed -e "s?\(^addClassPath.*\)?\1\n${extra_classpath}?" $1
}

borkdude11:11:33

Btw, there's also plenty npm deps that can do the kebab thing: https://www.npmjs.com/package/kebab-case

ray11:11:19

I'm working with keywords babe 🙂

ray11:11:04

anyway ... it's a fun adventure to find all the nooks and crannies a week before the project goes live

ray12:11:32

I just mean that I have to be careful now about what new features to adopt

ray15:11:36

goddammit I was just deploying my countermeasure 🙂

ray15:11:00

but in all sincerity, thanks