This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-23
Channels
- # babashka (4)
- # beginners (46)
- # biff (64)
- # calva (34)
- # cider (29)
- # cljdoc (12)
- # cljs-dev (16)
- # clojure (42)
- # clojure-australia (2)
- # clojure-china (1)
- # clojure-europe (35)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (4)
- # clojurescript (3)
- # core-typed (3)
- # cursive (5)
- # datalevin (3)
- # datomic (23)
- # hyperfiddle (92)
- # joyride (8)
- # juxt (3)
- # malli (1)
- # nbb (44)
- # pathom (10)
- # portal (3)
- # rdf (1)
- # reitit (10)
- # shadow-cljs (60)
- # sql (12)
"errorType": "Error",
"errorMessage": "No protocol method IAssociative.-assoc defined for type object: [object Object]",
"message": "No protocol method IAssociative.-assoc defined for type object: [object Object]",
"data": {...
TONS of junk
"cause": {
"errorType": "Error",
"errorMessage": "No protocol method IAssociative.-assoc defined for type object: [object Object]",
"stack": [
"Error: No protocol method IAssociative.-assoc defined for type object: [object Object]",
" at $APP.Cb (file:///var/task/node_modules/nbb/lib/nbb_core.js:27:47)",
" at $APP.bc (file:///var/task/node_modules/nbb/lib/nbb_core.js:33:233)",
" at $APP.Gj.j (file:///var/task/node_modules/nbb/lib/nbb_core.js:723:379)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:560:322",
" at R (file:///var/task/node_modules/nbb/lib/nbb_core.js:309:469)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:559:317",
" at R (file:///var/task/node_modules/nbb/lib/nbb_core.js:309:469)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:558:423",
" at R (file:///var/task/node_modules/nbb/lib/nbb_core.js:309:469)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:559:305"
]
},
"name": "Error",
"stack": [
"Error: No protocol method IAssociative.-assoc defined for type object: [object Object]",
" at new Al (file:///var/task/node_modules/nbb/lib/nbb_core.js:176:80)",
" at $APP.xn.j (file:///var/task/node_modules/nbb/lib/nbb_core.js:1257:319)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:333:364",
" at ss (file:///var/task/node_modules/nbb/lib/nbb_core.js:333:373)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:560:397",
" at R (file:///var/task/node_modules/nbb/lib/nbb_core.js:309:469)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:559:317",
" at R (file:///var/task/node_modules/nbb/lib/nbb_core.js:309:469)",
" at file:///var/task/node_modules/nbb/lib/nbb_core.js:558:423",
" at R (file:///var/task/node_modules/nbb/lib/nbb_core.js:309:469)"
]
if this is related to JSON, you should probably give a more minimal repro related to parsing JSON
so I would be interested in seeing how you are consuming JSON from Nbb… I dont have information on it, and Firefox fails when I try similar data
E.g. e repro like:
user=> (js/JSON.parse "{ password: '#DXXXX&QZZZZ', username: 'junk' }")
"SyntaxError: Unexpected token p in JSON at position 2"
thing I'm trying to work out is what makes js->clj
or ->clj
barf so cannot reproduce yet. It's data coming from an AWS secret manager so it's fun to debug 😅
scrap this thread ... was something else completely. One of the joys of async interop. I was trying to (:x x) on a vector. Hence the IAssociative problem. I guess that's the most common cause. So something like this ...
(let [x (some-call)]
{:k (:user x) :l (:pass x}) <--- oops
(let [[user pass] (some-call-that-I-should-have-known-results-in-a-vector)]
{:k user :l pass}) <-- all fine
just to demo that any string is fine
user=> (def x (js/JSON.stringify (clj->js {:x "#Y&c"})))
#'user/x
user=> x
"{\"x\":\"#Y&c\"}"
user=> (-> x js/JSON.parse)
#js {:x "#Y&c"}
user=> (-> x js/JSON.parse ->clj)
{:x "#Y&c"}
user=>
as well as that one, it was YAB (yet another bug) but still - thanks for the therapy 😅
one thing I learned is that tap>
is bad for debug cos it adds async to async ... prn
works a lot better
@jayzawrotny what is the current best practice for running tests? My way is via a runner.cljs that looks like this ... which requires some maintenance
(ns runner
(:require
[clojure.test :as t]
[acme.lambda-support-test]
[acme.api-gateway-test]
[acme.kafka-test]
[acme.webhook-test]))
(defmethod t/report [:cljs.test/default :end-run-tests] [m]
(if (t/successful? m)
(do (prn "Success!")
(js/process.exit 0))
(do (prn "FAIL")
(js/process.exit 1))))
(t/run-tests
'acme.api-gateway-test
'acme.lambda-support-test
'acme.kafka-test
'acme.webhook-test)
which I then run via
npx nbb --classpath src:test test/runner.cljs
That's roughly what I have atm, only difference is I used run-all-tests with a regex to match namespaces that end in -test
I still think it should support .cljc files too, so might require a PR if you're using that
Not sure I want to add bb to the prerequisites just for this though. Since nbb is explicitly server-side, why not build it in like the other systems do? Just a thought 😇
It seems like that library is just cljs targeting nbb. Where are you seeing the bb dependency?
$ nbb -cp test -m nextjournal.test-runner
----- Error --------------------------------------
Message: Could not find namespace: nextjournal.test-runner
Could not find namespace: nextjournal.test-runner
$ cat nbb.edn
{:deps
{io.github.nextjournal/nbb-test-runner {:git/sha "b9cb088adb9f406cb29c559cc6c59f68eb295916"}}}
See the https://github.com/babashka/nbb#clojure-dependencies for bb as a pre-requisiteAh thanks, all this time I thought nbb itself was using the nbb.edn, sounds like it just uses it for paths currently?