Fork me on GitHub
#figwheel-main
<
2022-02-04
>
magnars21:02:34

I'm trying to switch from lein-figwheel to figwheel-main. It now compiles my cljs using the settings in figwheel-main.edn and dev.cljs.edn. However, the websocket keeps disconnecting:

[goog.net.WebSocket] Opening the WebSocket on 
[goog.net.WebSocket] WebSocket opened on 
[goog.net.WebSocket] The WebSocket on  closed.
[goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined
How do I begin investigating this error? There's no error to be found anywhere that I've been able to spot.

magnars21:02:55

Note that it seems to be able to connect, but then immediately disconnects.

magnars21:02:23

This is using:

[com.bhauman/figwheel-main "0.2.16"]
[cider/piggieback "0.5.3"]
[nrepl "0.9.0"]

:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}
In case that is of any use.

magnars21:02:15

My figwheel-main.edn is nothing special:

{:open-url false
 :open-file-command "emacsclient"
 :watch-dirs ["src"]
 :css-dirs ["resources/public/css"]}

magnars21:02:30

Same goes for dev.cljs.edn:

{:main no-adventur.ui.director
 :optimizations :none
 :pretty-print true
 :source-map true
 :asset-path "/js/compiled/out"
 :output-to "resources/public/js/compiled/adventur.js"
 :output-dir "resources/public/js/compiled/out"
 :foreign-libs [{:file "public/js/slip.js" :provides ["slip"]}]}

magnars21:02:56

I'm starting figwheel in the repl with:

(figwheel.main/start "dev")

magnars21:02:27

Which results in a happy compiler and a properly built set of js-files.

magnars21:02:12

The ws-server gives:

HTTP/1.1 101 Switching Protocols

magnars21:02:02

So it is able to reach it, but possibly not on the new protocol? Unexpected disconnects are pretty expected at this point. 🙃

magnars21:02:32

I am now investigating dependency clashes.

magnars21:02:35

I have now been able to fix this issue. I'll report back when I find which dependency was the culprit.

magnars08:02:59

For posterity: The culprit turned out to be `[ring "1.7.1"]` . This collided with figwheel-main's `1.9.1` of the same library, and in turn jetty and jetty's websocket implementation.

magnars21:02:09

Edit 30 minutes later: I have been able to fix this. Will report back when I figure out which dependency was the culprit. duckie

magnars22:02:46

The culprit turned out to be [ring "1.7.1"] . This collided with figwheel-main's 1.9.1 of the same library, and in turn jetty and jetty's websocket implementation.

magnars22:02:10

Going from 4 separate builds to a single figwheel-main build with 3 :extra-main-files 😍

mikerod22:02:38

Seems clashes with jetty are common here