I have a Luminus project with the server running on localhost:7000. I use cider-connect to attach myself to this repl, but I'm met with the following wall:
; CIDER 0.10.0snapshot (package: 20150820.852) \
(Java 1.7.0_51, Clojure 1.7.0, nREPL 0.2.10)
WARNING: The following required nREPL ops are not supported:
apropos classpath complete eldoc format-code format-edn info inspect-pop \
inspect-push inspect-refresh macroexpand ns-list ns-vars ns-path refresh \
resource stacktrace toggle-trace-var toggle-trace-ns undef
Please, install (or update) cider-nrepl 0.10.0-SNAPSHOT and restart CIDER
I would imagine at least one of these is required for debugging; attempts to instrument a function yield
clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: \
No reader function for tag dbg
I can debug just fine with a 'normal' Clojure project. I've tried adding the boilerplate that normally goes in ~/.lein/profiles.clj to the project's project.clj to no effect:
:profiles/dev {:dependencies [[org.clojure/tools.nrepl "0.2.10"]]
:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}
How can I attach CIDER's debugger to this web application?
In the interest of saving time of people who have similar issue I'll post summary here as an answer. Thanks to Benedek Fazekas from
clojure-emacs/refactor-nrepl's gitter and Sean Allred.To attach
CidertoLuminusapplication (and probably any other application which uses embeddednrepl serveras an opportunity of connecting to it while it's running) you should do two things:Provide all desired middleware as
:handlertoclojure.tools.nrepl.server/start-server. To do this you should have libraries which contain middleware listed somewhere whereleincan find them (e.g. inproject.clj:dependencies).Run application which launches embedded
nrepl serverand connectCiderto it usingcider-connect.Beside
cider-nreplI want to userefactor-nreplwhich is needed by Clojure refactor. With example project from Luminus website first thing can be done like this:Then you can run your
Luminusapp withlein runand connect it withCiderusingcider-connect(M-x cider-connectorC-c M-c), by default url to connect islocalhost:7000.Presumably, embedded
nrepl serverinLuminusis intended to be used when application is already deployed somewhere and you want to do some live debugging. For local development there is standard way:lein replin the project root.Ciderwill do the job withlein repl :headlessoncider-jack-in(C-c M-j).replinyourapp.corenamespace where you can run(http/start {:port 3000 :init init :handler app})and enjoy! In this case we don't need embeddednrepl server. To stop http server run(http/stop destroy). It is described here.