Figwheel REPL Timeouts in Understanding Re-frame Course

Hi all,

I’m excited to take the Understanding Re-frame course on this website but have run into a bit of a roadbump on the Getting Set Up lesson. On a clean emacs config with only CIDER installed, I run

$CMD git clone https://github.com/lispcast/understanding-re-frame.git 
$CMD cd understanding-re-frame
$CMD git checkout -f 001    

Then, I open up src/cljs/understanding_re_frame/components.cljs (or any other file in the project) and execute cider-jack-in-cljs with C-c M-J. Emacs prompts me for a Clojurescript REPL type and I submit figwheel. Emacs then times out with the following output:

[nREPL] Starting server via /usr/bin/lein update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.4.1\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.22.0-beta4\"\] -- repl :headless :host localhost...
[nREPL] server started on 35155
[nREPL] Establishing direct connection to localhost:35155 ...
[nREPL] Direct connection to localhost:35155 established
error in process filter: nrepl-send-sync-request: Sync nREPL request timed out (op clone id 1)
error in process filter: Sync nREPL request timed out (op clone id 1)

The nrepl buffer shows the following:

Compiling ClojureScript...
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: medley.core, being replaced by: #'medley.core/boolean?
[WARNING] No nREPL middleware descriptor in metadata of #'cemerick.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
nREPL server started on port 35155 on host localhost - nrepl://localhost:35155
ERROR: Unhandled REPL handler exception processing message {:op clone, :id 1}
java.lang.NullPointerException
	at clojure.core$deref_future.invokeStatic(core.clj:2300)
	at clojure.core$deref.invokeStatic(core.clj:2320)
	at clojure.core$deref.invoke(core.clj:2306)
	at cemerick.piggieback$wrap_cljs_repl$fn__2252.invoke(piggieback.clj:289)
	at clojure.tools.nrepl.middleware$wrap_conj_descriptor$fn__1848.invoke(middleware.clj:22)
	at nrepl.server$handle_STAR_.invokeStatic(server.clj:18)
	at nrepl.server$handle_STAR_.invoke(server.clj:15)
	at nrepl.server$handle$fn__1116.invoke(server.clj:27)
	at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2030)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

I have been trying to track down what is going wrong for a fair amount of time, but I am not sure what the process for debugging something like this is. Here is my set up (I’ve also had the same issue on OpenJDK 8):

$CMD lein --version
Leiningen 2.9.1 on Java 11.0.3 OpenJDK 64-Bit Server VM
$CMD emacs --version
GNU Emacs 26.2
...

Does anyone have any advice for finding a fix? Any pointers would be greatly appreciated! Thanks.

I solved this today by migrating my emacs configuration to melpa-stable, under the following advice from user dotemacs on the #beginners channel of the Clojure Slack:

Not sure what you’re doing exactly, but there’s a good chance that your version of nREPL and and nREPL middleware for figwheel don’t match. Start from that.I just had a look and if it’s this section: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl#detailed-and-automated-setup-does-not-work-in-all-versionsThen that write up is a bit outdated. The current stable CIDER is 0.21.

See: https://github.com/clojure-emacs/cider/releases/tag/v0.21.0I’d say that you’d definitely want to follow their general advice, but for melpa-stable use this URL https://stable.melpa.org/packages/ instead.When it talks about cider/piggieback, use the latest version 0.4.0. And where it talks about lein-figwheel, make sure that this version matches figwheel-sidecar, which is 0.5.18 right now.

I hope this helps out anyone else with a similar problem!

Hi @mhorning,

I’m glad you got it resolved. You did it faster than I could respond :slight_smile:

Eric

Hey everyone. I was able to make it work here without migrating to Melpa stable by changing the dev dependency of piggieback to cider/piggieback "0.4.1" and the :nrepl-middleware to cider.piggieback/wrap-cljs-repl.

Followed the instructions on the new Cider docs https://docs.cider.mx/cider/basics/clojurescript.html.