I have a problem with starting shadow-cljs server on my Jenkins Alpine Linux machine using shadow-cljs start
After long time I’m getting
shadow-cljs - server starting "a lot of dots and" `Cannot contact jenkins_cluster: hudson.remoting.RequestAbortedException: java.nio.channels.ClosedChannelException` error.
It could be some policy of our Jenkins which doesn’t allow that but I cannot find any information which I can pass to our DevOps to investigate that. Is the some way to get more details what is going on under the hood of this command? Or maybe there is a way to enable some logs (`-v` and --debug
shows nothing)?@thheller thanks for you advices, they helped me to find root cause of the problem. I will create an issue in GitHub for use case that start
is hanging when error occurs during start up if you don’t mind.
My root issue on Jenkins was that jks ssl certificate which we use for local environment was not committed and I still not sure is it a good idea to commit it. Is it possible somehow to force shadow-cljs to ignore ssl certificate if it is not found instead of throwing exception?
if the cert is not found ssl won't work? or do you not need that to work?
I don’t need that to work. I need SSL for local server but not when I run tests
hmm yeah I guess there should be an option to disable that but for CI you could just write a simple script that just deletes the :ssl
config from shadow-cljs.edn
before actually starting it
Option will be better, but I try to write something in meanwhile
(require '[<http://clojure.java.io|clojure.java.io> :as io])
(require '[clojure.edn :as edn])
(let [file (io/file "shadow-cljs.edn")]
(-> (slurp file)
(edn/read-string)
(dissoc :ssl)
(as-> config
(spit file (pr-str config)))))
if you have clojure
installed on the CI system you can just put that into a script file and run it with that
or use something like babashka
thanks a lot. I’ll try
feel free to open issues about this. can't get to it now but maybe later
While setting up :js-provider :external
, I have found that it only works with ["react" as react]
style requires. Meaning that both the string-style and the alias is required in order for the corresponding js require to be generated. Is this a known issue/by design? This could be very tricky for others to figure out. The string syntax is fine, when documented, but the required alias is more of a pitfall.
The same is going one when I try to run shadow-cljs start
on Docker image https://github.com/theasp/docker-clojurescript-nodejs locally. You can reproduce it from your project directory using
docker run --rm -v ${PWD}:/home/my-project -w="/home/my-project" theasp/clojurescript-nodejs:latest npx shadow-cljs start
why are you using start
in a CI environment?
@ingesol that is a bug yes
@thheller Ok, I’ll retest to verify the pattern and post a bug
@thheller I would like to use https://github.com/lambdaisland/kaocha-cljs2 to run tests and I need somehow to serve the compiled tests with shadow-cljs, so I have decided to use shadow-cljs
server for that. I am not sure if it is the best choice. I would appreciate a better advice on that if you have
hmm I don't know anything about kaocha or how it runs tests unfortunately
you could maybe run the tests via https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run
Actually what I need is to serve the complied directory with lambdaisland.chui.remote
to be preloaded. And shadow-cljs server
looks ideal. I could try to look for another way to achieve the same. But do you have any idea why it doesn’t work on Docker? Is it expected or can I log the issue in GitHub for that?
I don't have a clue why it wouldn't work. maybe the logfiles created in the .shadow-cljs/
dir provide some clues? I'm not capable of debugging docker issues. if server
works fine I'd assume start
to work as well since the only thing it does is detach to process into the background.
let me actually check if shadow-cljs server
works inside Docker. I haven’t checked it separately
Hi. I am building with :target :node-library
and I would like to use the fetch
api. But (js/fetch ...)
fails with fetch is not definded
and requiring ["node-fetch"]
fails with symbol module$shadow_js_shim_module$node_fetch already provided by [:shadow.build.js-support/require "node.fetch"], conflict with [:shadow.build.js-support/require "node-fetch"]
. Any suggestions how to access the fetch
function? Thank you.
looks like you have a node.fetch
and a node-fetch
? they clash, stick to one I guess?
@thheller when I am using shadow-cljs server
with local docker I get a project specific error (out of scope for my question). But it seems shadow-cljs start
hanging when errors occur, is it possible?
how does it fail? could certainly affect start
yes
shadow-cljs server
failed (actually process just ends) during fetching lein private dependencies because of luck of permissions. During shadow-cljs start
it just shows dots
What do you mean by "you have"? In my own namespaces I don't use any of these. But I would like to and I can not fugure out how to require it.
you said "requiring node-fetch failed". try node.fetch
which shadow-cljs version do you use? I thought these kinds of clashes were fixed?
yeah with start
all logging goes into the log files in .shadow-cljs/server.stdout.log
or server.stderr.log
I am on the latest version. Requiring [node.fetch :as nf]
errors in the compiler with he required namespace "node.fetch" is not available
. Requiring ["node.fetch" :as nf]
passes the compiler, but errors at runtime when loading with Error: Cannot find module 'node.fetch'
. 😞
I'm confused then. something else appears to be using it?
so even if you fix your end it still won't run since that uses it?
Everything runs fine. Until I require anything of it.
I'm entirely confused. WHERE does the "node.fetch"
come from? if you ONLY have "node-fetch"
that should be totally fine but having that as well as "node.fetch"
will not work
as the error tells you SOMETHING required "node.fetch"
I have some dependencies. Like firebase-admin
and firebase-functions
. Perhaps it comes from there.
not if you are using :node-library
, then shadow-cljs will not process any npm dependencies at all. some CLJS code must be requiring that
Ok, I will check. Or narrow down my scope. Thank you very much for your time!
also verify which shadow-cljs version you are using. I thought I fixed this particular issue.
the problem is that node-fetch
AND node.fetch
both munge into the module$shadow_js_shim_module$node_fetch
pseudo-namespace and they need to be unique
although I don't understand how you get that name to be honest. that should be shadow.js.shim.module$node_fetch
. might be something weird in your setup, can't say
For the record. What I forgot to mention 😞 is that my compiled code is not executed directly - instead the Firebase Cloud Functions Emulator loads it. I added "node-fetch" to my package.json and now requireing "node-fetch" works.