Fork me on GitHub
#arachne
<
2018-01-26
>
jcf17:01:16

Anyone got a solution to this:

Uncaught TypeError: goog.net.jsloader.load is not a function
    at figwheel$client$file_reloading$reload_file_in_html_env (file_reloading.cljs?rel=1516980062278:208)
    at figwheel$client$file_reloading$reload_file (file_reloading.cljs?rel=1516980062278:250)
    at figwheel$client$file_reloading$blocking_load (file_reloading.cljs?rel=1516980062278:269)
    at file_reloading.cljs?rel=1516980062278:279
    at file_reloading.cljs?rel=1516980062278:277
    at figwheel$client$file_reloading$state_machine__59709__auto____1 (file_reloading.cljs?rel=1516980062278:277)
    at figwheel$client$file_reloading$state_machine__59709__auto__ (file_reloading.cljs?rel=1516980062278:277)
    at cljs$core$async$impl$ioc_helpers$run_state_machine (ioc_helpers.cljs?rel=1516980058153:35)
    at cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped (ioc_helpers.cljs?rel=1516980058153:39)
    at ioc_helpers.cljs?rel=1516980058153:48
I'm trying to get Arachne Figwheel to reload JS, but the first time the changes are pushed to the browser this error occurs, and then code reloading is broken.

jcf17:01:16

@luke any ideas ⬆️ ? I'm using the latest versions of all Arache deps.

jcf17:01:43

org.arachne-framework/arachne-figwheel {:mvn/version "0.2.0-master-0032-bb33280"}
org.arachne-framework/arachne-pedestal {:mvn/version "0.2.0-master-0064-fb2edbc"}
org.arachne-framework/arachne-sass {:mvn/version "0.2.0-master-0034-1769b93"}
org.arachne-framework/pedestal-assets {:mvn/version "0.2.0-master-0019-580de8f"}

jcf17:01:20

I've also had to disable the ::webjars config because I get a spec failure with some ZIP object in place of a directory.

luke17:01:35

@jcf hmm, I haven’t ever seen that before. Any chance you could post your config script including what your cljs compiler settings are?

jcf17:01:45

Of course.

jcf17:01:42

That's my config, including the cljs-opts I pulled out of the enterprise SPA template.

luke17:01:57

and is this in dev or whitespace mode?

luke17:01:03

er, sorry, dev or advanced?

jcf17:01:05

And here's the exception from webjars not being happy:

ExceptionInfo Call to #'arachne.fileset/add did not conform to spec:
In: [1] val: #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"] fails spec: :arachne.fileset.specs/directory at: [:args :directory] predicate: (fn [f] (and (instance? java.io.File f) (.isDirectory f)))
 {:clojure.spec.alpha/problems [{:path [:args :directory], :pred (clojure.core/fn [f] (clojure.core/and (clojure.core/instance? java.io.File f) (.isDirectory f))), :val #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"], :via [:arachne.fileset.specs/directory :arachne.fileset.specs/directory], :in [1]}], :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2436 0x6d2bdcdc "clojure.spec.alpha$regex_spec_impl$reify__2436@6d2bdcdc"], :clojure.spec.alpha/value (#arachne.fileset.impl.TmpFileSet{:tree {}, :blob #object[java.io.File 0x47780f5c "/tmp/arachne-fs1560548959238895091"], :scratch #object[java.io.File 0x31a747 "/tmp/arachne-fs3449467318418299623"], :cache #object[java.io.File 0x6b214f83 "/tmp/arachne-fs283219324983436992"]} #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"]), :clojure.spec.alpha/args (#arachne.fileset.impl.TmpFileSet{:tree {}, :blob #object[java.io.File 0x47780f5c "/tmp/arachne-fs1560548959238895091"], :scratch #object[java.io.File 0x31a747 "/tmp/arachne-fs3449467318418299623"], :cache #object[java.io.File 0x6b214f83 "/tmp/arachne-fs283219324983436992"]} #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"]), :clojure.spec.alpha/failure :instrument, :clojure.spec.test.alpha/caller {:file "pipeline.clj", :line 135, :var-scope arachne.assets.pipeline/classpath-fileset, :local-fn fn}}
	clojure.core/ex-info (core.clj:4739)
	clojure.core/ex-info (core.clj:4739)
	clojure.spec.test.alpha/spec-checking-fn/conform!--2938 (alpha.clj:131)
	clojure.spec.test.alpha/spec-checking-fn/fn--2943 (alpha.clj:139)
	arachne.assets.pipeline/classpath-fileset/fn--32336 (pipeline.clj:135)
	clojure.core.protocols/fn--7852 (protocols.clj:168)
	clojure.core.protocols/fn--7852 (protocols.clj:124)
	clojure.core.protocols/fn--7807/G--7802--7816 (protocols.clj:19)
	clojure.core.protocols/seq-reduce (protocols.clj:31)
	clojure.core.protocols/fn--7833 (protocols.clj:75)
	clojure.core.protocols/fn--7833 (protocols.clj:75)
	clojure.core.protocols/fn--7781/G--7776--7794 (protocols.clj:13)

jcf17:01:39

I have (def dev? (constantly true)), and my cljs-opts:

(def cljs-opts {:main 'usr.client
                :optimizations (if (dev?) :none :advanced)
                :asset-path "/js/out"
                :output-to "js/app.js"
                :output-dir "js/out"
                :source-map-timestamp true})

jcf18:01:02

So optimisations will be :none.

jcf18:01:55

Commenting out the ::webjars input-dir and related pipeline entries circumvents the spec error with a ZipPath.

jcf18:01:35

I'm not using any webjars so don't need that for now. I can open an issue/PR that changes the spec so zipped ditties are accepted…

luke18:01:12

right, so that error is (fairly) straightforward, apparently a directory in a Zip is not considered a directory and therefore can’t be used in Arachne’s asset pipeline. That definitely is something that should be enhanced

luke18:01:32

although I could have sworn I had that working…

luke18:01:02

how private is this project? Is it the kind of thing you would be willing to clone and let me reproduce locally? I will continue to think about it but honestly with FactUI and some other client work my head has been out of the asset pipeline for a while.

jcf18:01:11

Yeah, the Zip bit seems straightforward enough to fix if ZipPaths are supported.

jcf18:01:39

I'll open up the repo.

jcf18:01:59

Not production quality! 🙂

jcf18:01:55

Oh, and I'm doing some gnarly stuff with deps.edn mixed with Leiningen because I want to try out something simpler (ultimately Arachne + tools.deps).

luke18:01:32

I need to go pick up my kid right now but I will to reproduce your problem this afternoon.

jcf18:01:05

Cool! I'll keep an eye on Slack, and keep at trying to fix this myself.

jcf18:01:00

@luke fixed it here: https://github.com/jcf/usr/commit/8281da793b18a95aa3bfcdb1b9a2c76f631b2576 Looks like something's been fixed in a recent release of Figwheel (I read that load was replaced with safeLoad but haven't dug deeper).

jcf18:01:02

Upgrading Figwheel fixed the problem with jsloader.load not being around but now I get this:

jcf18:01:35

Too many open files (I guess something to do with the fs abstraction inspired by Boot?).

jcf18:01:55

THen clicking the error spits out this:

heads_up.cljs?rel=1516991443932:39 Uncaught TypeError: Cannot read property 'figwheelEvent' of undefined
    at heads_up.cljs?rel=1516991443932:39
    at core.cljs:4353
    at cljs.core.keep.cljs$core$IFn$_invoke$arity$2 (core.cljs:4353)
    at cljs.core.LazySeq.sval (core.cljs:3380)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (core.cljs:3438)
    at cljs.core.LazySeq.cljs$core$ISeq$_first$arity$1 (core.cljs:3404)
    at cljs$core$first (core.cljs:1220)
    at figwheel$client$heads_up$get_dataset (heads_up.cljs?rel=1516991443932:39)
    at HTMLDivElement.figwheel$client$heads_up$heads_up_onclick_handler (heads_up.cljs?rel=1516991443932:43)

jcf18:01:17

If we've exhausted the number of files we're allowed to open, all bets are off. 😉

jcf18:01:33

List of all the files opened by this Arachne-managed process:

jcf18:01:17

I can up my ulimit etc.

jcf18:01:28

If I change the string in my views/Layout a few times I can reliably max out the open file limit.

jcf18:01:58

$ ulimit -Hn
4096

amarjeet19:01:55

Is there any way to update a fact in the session?

amarjeet19:01:54

in factui session

amarjeet19:01:15

I have a rule that says if A is true then insert-logical B. And, at first, one event-handler inserts the fact that A is true, so B gets inserted. Now, in another event-handler, I want to either set A to false or retract A, so that B can automatically be retracted.

luke19:01:48

@jcf ok, let me get my head around the open files issue. that came up on another project a couple months ago and we found a workaround, I’ll refresh my memory on that end get back to you.

jcf19:01:40

You should be able to reproduce the too many open files issue using my usr repo. If you trigger a reload by changing a cljs file a few times it pops up. I vauguely remember reloading the system via reset from the user ns contributed but can’t find an example right now.

jcf19:01:39

I’m planning on doing some more work with Arachne and will likely open source most if not all of what I achieve. If you have a roadmap or want to collaborate on something let me know. Thanks, Luke! Catch you later.

luke19:01:09

@jcf see my message in the main channel

luke19:01:13

that issue was fixed I think

luke19:01:22

but possibly not included in a release version yet

luke19:01:59

glad you’re finding Arachne interesting, eager to see what you do with it. Let me know if there’s anything else I can do to help

luke19:01:14

@amarjeet that should work already if the fact is cardinality one; it will be replaced and the logical rule effect will happen

luke19:01:28

if it’s cardinality many then the old fact is still true as well, so nothing will be retracted

amarjeet19:01:40

oh okay, I wasn't setting the cardinality option. I just used (f/transact-logical! [{:db/ui true}])

luke19:01:50

yeah facts are cardinality many by default

luke19:01:58

unless you have a schema setting them to one

amarjeet19:01:13

got it, thats helpful. thanks much luke

luke19:01:00

It’s possible I forgot/didn’t make a release of that for some reason

luke19:01:17

what version of arachne-fileset is your project using? (you can check this using lein deps :tree or something like that

jcf19:01:32

@luke https://github.com/jcf/usr/blob/master/deps.edn gets slurped into project.clj. I’ll copy and paste the version now…

luke19:01:13

@jcf right: the arachne-fileset lib is a transitive dependency of the Arachne assets module

jcf19:01:15

Oh, sorry. Didn’t see you wanted a transitive dependency.

luke19:01:30

you want version 1.6.1, 1.6.0 has the “open files” bug

jcf19:01:39

I’m AFK at the mo (it’s Friday night and 19:55 here).

luke19:01:45

ah, k 🙂

luke19:01:02

for now you can just manually include the newest version of org.arachne-framework/arachne-fileset

jcf19:01:08

I’ll add an explicit dependency to my deps.edn just like Figewheel Sidecar.

luke19:01:12

I’ll cut a release of Arachne proper upgrading the dependency soon

jcf19:01:22

Awesome. Thanks, @luke.

luke19:01:24

and include the sidecar version bump which it sounds like I’ll need as well

luke19:01:42

might be a few days, I will probably port Arachne to deps.edn at the same time.

luke19:01:52

since I now prefer that approach, since it’s out

jcf19:01:10

Added Figwheel Sidecar in master.

luke19:01:15

woot, thanks

luke19:01:27

I’ll roll that into the core project

jcf19:01:00

tools.deps is a breath of fresh air. Loving the recent output from the Cognitect guys(I guess mainly Alex??)

luke19:01:20

Rich has the ideas, Alex does the work 😉

jcf19:01:14

How do I ‘retweet’ a Slack comment? 🤣

luke20:01:57

you don’t, which is why I can say such things here