I can't seem to get any of the (dirac!
commands to work š
nvm it works now :simple_smile:
After running (dirac! :join)
, trying to eval anything gives me an error like this:
dirac.lib.nrepl-tunnel-server | [NREPLTunnelServer#1 of [NREPLTunnel#1]] Received an error from client [WebSocketServerClient#1] :
| {:err
| "Unable to unserialize forwarded nREPL message:\n {:ns \"frontend.core\", :file \"*cider-repl localhost*\", :op \"eval\", :column 15, :line 54, :pprint-fn #function[cider.nrepl.middleware.pprint/wrap-pprint-fn/fn--24400/fn--24402], :id \"15\", :code \"1\\n\"}",
| :op :error,
| :id "01100e8b-53ed-4680-a514-83c9458097fc"}
I'm seeing this in both cider and the lein repl
I'm guessing this is because of the cider-nrepl middleware?
Removing all other middleware is a good first step
š
that did work!
most emacs users have cider-nrepl middleware in their ~/.lein/profiles.clj
though, so it would be hard to convince my team to remove it š
@frank: Iām pretty sure we will figure a way how to make it work
ok, looking at the code, the whole problem is that the message is unserialisable on client side because of that :pprint-fn key, not sure why they include this key there in a form which is not portable background info: when you switch your session into joined dirac session (meaning joined to some āsourceā session), I send all incoming nrepl messages (e.g. āeval" requests) to your joined session to client-side to be processed by Dirac devtools, is can implement the nrepl message directly if appropriate or send it back to the āsourceā session for actual processing. In any case I need to unserialise the message on client side to look at the operation and act appropriately.
I see
can the key be ignored?
yes, we can easily make a hack to accommodate your case, but I would like to think about it more and find more general solution
:thumbsup:
dissoc all vals that aren't strings?
I use read-string on client side, maybe I could use some other function which would skip unserializable keys or something, I donāt want to implement some nrepl message transformation on server side, if possible
ah
cannot do dissoc prior parsing it
I get a string and I need to parse it on client side
gotcha
this is the current implementation: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/intercom.cljs#L260-L264
you get back this response: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/intercom.cljs#L291
btw that error logging could tell you more about the problem, it gets logged into Diracās console (the console you can open from Dirac DevTools window)
I mean this line: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/intercom.cljs#L264
ah ok I didn't look there
would be nice to look there to confirm my theory, I donāt really have cider stuff set up and running
I think all that's needed is to add something like [cider/cider-nrepl "0.11.0"]
to :plugins
in project.clj
and the issue should reveal itself in the lein repl
ok, will try it
but I will try too š
@darwin: I didn't see it in my dirac window
hmm, that means that this read-string returned nil without throwing? https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/intercom.cljs#L262
sounds like it
Iām looking into cljs.reader/reader and clojure.edn/reader, not clear if any of them will be able to parse the message and somehow skip unparseable bits
as I said I would like to solve it on client-side if possible
or maybe even cljs.tools.reader?
ahh I think I understand what you've been saying now
looking at the docs of cljs.reader/read-string and it does not thow by default, just silently returns nil, so that is why we are not getting that error log
throwing can be enabled, that would be an improvement, but that would not solve our problem at hand
@frank: I was able to reproduce the issue, just looking at the devtools console and that read-string really throws: https://dl.dropboxusercontent.com/u/559047/hmm-throws.png note that ātroubles unserializing message"
you were probably looking at wrong console.
hm I didn't see that
oh yeah I was looking at dirac console
this is console of the devtools window, not the console of your appās page window
ooooh
right
I keep forgetting I can do that
I have there more messages because Iām running the dev build, maybe yours would look different
I will be able to fix it on client side, at least with tools.reader, we can specify our own "tag parsers"
so I will be able to parse it and turn all unknown tags to nil values
also a workaround for you could be to exclude wrap-pprint-fn middleware: https://github.com/clojure-emacs/cider-nrepl#via-leiningen
btw. that :plugins approach didnāt work for me, I had to go :dependencies route and cofigure :repl-options myself
for some reason adding just cider-nrepl as plugin didnāt work with my project configuration somehow
ah
@frank: realized that on nrepl (server) side checking for this makes more sense, but after implementing it on client side, so I kept both: https://github.com/binaryage/dirac/commit/e98d8b92877a62c828fffad392e57c26e0693650 https://github.com/binaryage/dirac/commit/7b4b4e1f76a6a21c598015b3050350b29ce621bc