Fork me on GitHub
#shadow-cljs
<
2022-03-27
>
olaf00:03:26

I’m getting this error when I add :deps {:aliases [:dev]} to my shadow conf. Running clj -M:dev has no error

Execution error (ClassCastException) at clojure.tools.cli/tokenize-args (cli.cljc:34).
class clojure.lang.ArraySeq cannot be cast to class java.lang.CharSequence (clojure.lang.ArraySeq is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader 'bootstrap')

olaf00:03:53

P.S. I ported project.clj to deps.edn so maybe I missed something

Drew Verlee02:03:17

What do you expect to happen? Do you want to point shadow at a deps file?

thheller06:03:06

what does your deps.edn look like? the error is in there

olaf07:03:25

@U0DJ4T5U1 yes, to get path and deps here is my deps.edn

{:paths ["src/clj" "src/cljc" "src/cljs" "resources"]

 :deps
 {buddy/buddy-auth {:mvn/version "3.0.323"}
  buddy/buddy-core {:mvn/version "1.10.413"}
  buddy/buddy-hashers {:mvn/version "1.8.158"}
  buddy/buddy-sign {:mvn/version "3.4.333"}
  ch.qos.logback/logback-classic {:mvn/version "1.2.10"}
  cljs-ajax/cljs-ajax {:mvn/version "0.8.4"}
  clojure.java-time/clojure.java-time {:mvn/version "0.3.3"}
  com.cognitect/transit-clj {:mvn/version "1.0.329"}
  com.cognitect/transit-cljs {:mvn/version "0.8.269"}
  conman/conman {:mvn/version "0.9.3"}
  cprop/cprop {:mvn/version "0.1.19"}
  day8.re-frame/http-fx {:mvn/version "0.2.4"}
  expound/expound {:mvn/version "0.9.0"}
  funcool/struct {:mvn/version "1.4.0"}
  haslett/haslett {:mvn/version "0.1.7"}
  json-html/json-html {:mvn/version "0.4.7"}
  luminus-http-kit/luminus-http-kit {:mvn/version "0.1.9"}
  luminus-migrations/luminus-migrations {:mvn/version "0.7.1"}
  luminus-transit/luminus-transit {:mvn/version "0.1.5"}
  luminus/ring-ttl-session {:mvn/version "0.3.3"}
  markdown-clj/markdown-clj {:mvn/version "1.10.8"}
  metosin/muuntaja {:mvn/version "0.6.8"}
  metosin/reitit {:mvn/version "0.5.15"}
  metosin/ring-http-response {:mvn/version "0.9.3"}
  mount/mount {:mvn/version "0.1.16"}
  nrepl/nrepl {:mvn/version "0.9.0"}
  org.babashka/sci {:mvn/version "0.3.3"}
  org.clojure/clojure {:mvn/version "1.10.3"}
  org.clojure/clojurescript {:mvn/version "1.11.4"}
  org.clojure/core.async {:mvn/version "1.5.648"}
  org.clojure/tools.cli {:mvn/version "1.0.206"}
  org.clojure/tools.logging {:mvn/version "1.2.4"}
  org.postgresql/postgresql {:mvn/version "42.3.2"}
  org.webjars.npm/bulma {:mvn/version "0.9.3"}
  org.webjars.npm/material-icons {:mvn/version "1.0.0"}
  org.webjars/webjars-locator {:mvn/version "0.42"}
  re-frame/re-frame {:mvn/version "1.2.0"}
  reagent/reagent {:mvn/version "1.1.0"}
  ring-webjars/ring-webjars {:mvn/version "0.2.0"}
  ring/ring-core {:mvn/version "1.9.5"}
  ring/ring-defaults {:mvn/version "0.3.3"}
  selmer/selmer {:mvn/version "1.12.50"}
  thheller/shadow-cljs {:mvn/version "2.17.8"}}

 :aliases
 {:dev
  {:jvm-opts ["-Dconf=dev-config.edn"]
   :extra-paths ["env/dev/clj" "env/dev/cljs" "env/dev/resources" "test/cljs"]
   :extra-deps {binaryage/devtools {:mvn/version "1.0.5"}
                cider/piggieback {:mvn/version "0.5.3"}
                org.clojure/tools.namespace {:mvn/version "1.2.0"}
                prone/prone {:mvn/version "2021-04-23"}
                re-frisk-remote/re-frisk-remote {:mvn/version "1.5.2"}
                ring/ring-devel {:mvn/version "1.9.5"}
                ring/ring-mock {:mvn/version "0.4.0"}}
   :main-opts ["-m" "user"]}

  :test
  {:jvm-opts ["-Dconf=test-config.edn"]
   :extra-paths ["test"]
   :extra-deps {pjstadig/humane-test-output {:mvn/version "0.11.0"}}}

   ;; Linter
  :eastwood
  {:main-opts ["-m" "eastwood.lint"
                 ;; Any Eastwood options can be passed here as edn:
               {}]
   :extra-deps {jonase/eastwood {:mvn/version "1.2.3"}}}}}

thheller10:03:39

not sure. this is a problem with the tools.deps setup and not related to shadow-cljs. maybe try updating tools.deps or so.

thheller10:03:11

I'm guessing the problem is within the :dev alias having :main-opts

thheller10:03:26

since shadow-cljs will append its own arguments there it likely just conflicts

thheller10:03:33

might be fine if you remove that

olaf10:03:30

yes, was :main-opts , removed and is working fine, but I cannot load the clojure user namespace anymore. do you have any idea how to specify it into deps or shadow-dev?

thheller11:03:21

what does load the clojure user namespace mean to you? it'll always be "loaded" when it is on the classpath

thheller11:03:42

but the -main function doesn't run if you mean that

thheller11:03:47

you can just run clj -M:dev and run shadow-cljs in embedded mode from that https://shadow-cljs.github.io/docs/UsersGuide.html#embedded

thheller11:03:03

or you create a separate alias to launch your backend server and run shadow-cljs separately (which I recommend)

olaf11:03:26

okay, another alias. thanks for your help!

barrell19:03:24

I upgraded to the latest cljs and added a web worker over the weekend. Now when I open a release build, I’m getting an error that it cannot connect to ws://<domain>:9630. I’m tried deleting the build directory and re-releasing without running the watch command but I’m still getting ws/REPL/UI code. Is this a known issue? The only references I have to any shadow modules in my codebase are shadow.loader to load static files, those calls have not changed Full error: websocket.cljs:12 Mixed Content: The page at 'https://<domain>/pixi' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://<domain>:9630/api/remote-relay?server-token=c17d72ac-00fb-482a-8eb5-3ac7c88e9fba'. This request has been blocked; this endpoint must be available over WSS.

thheller19:03:26

a release build will never connect to :9630? are you maybe loading an outdated file?

barrell19:03:13

I removed the entire build directory and recreated it with release

thheller19:03:28

that doesn't necessarily mean anything

thheller19:03:33

you could have a bad cache

thheller19:03:37

a bad service worker

thheller19:03:45

or something along those lines

thheller19:03:18

don't know anything about what you are building but the ws connection to :9630 is for the development websocket

thheller19:03:27

it is not part of a release build unless you manually made it so?

barrell19:03:44

hm I can remove the shadow-cljs cache, what do you mean a bad service worker though?

thheller19:03:55

do you have a service worker?

barrell20:03:16

yes, I just added one so it sounds topical 😂

thheller20:03:28

service worker

thheller20:03:33

not web worker

thheller20:03:43

significant difference and totally different

thheller20:03:54

if you don't know what a service worker is you probably do not have one?

barrell20:03:23

haha probably not

thheller20:03:34

the thing you start with (js/Worker. ...) is webworker. that is fine and not related.

barrell20:03:53

I have always known web workers as service workers I guess

barrell20:03:03

but no I don’t have two different worker types

thheller20:03:04

do you manually require any of the shadow.cljs.devtools namespaces in your code somewhere? or in your build config?

barrell20:03:18

nope, that was one of the firs tthings I checked

thheller20:03:28

ok then it shouldn't try to connect anywhere

thheller20:03:37

then just make sure you are actually loading the files you think you are loading

barrell20:03:45

I am deploying a new build after removing the cache

barrell20:03:56

sorry I did not think to check that

thheller20:03:57

its common that people don't notice they still load files from an old directory or something

thheller20:03:26

easy test is actually deleting all the files and not rebuilding it

thheller20:03:36

if you still get JS errors you have some old files somewhere 😛

barrell20:03:56

still having JS errors

barrell20:03:21

I will hunt them down I guess ¯\(ツ)

barrell20:03:30

no idea where to start but I’ll make do haha (other than all the places I’ve already destroyed)

barrell20:03:33

thanks for the responses