Fork me on GitHub
#shadow-cljs
<
2018-10-17
>
tony.kay00:10:54

I think maybe when I convert a clj -> cljs file? I think I did that shortly before this started happening…I noticed the real error was missing a : on require

tony.kay00:10:18

i.e. (ns ... (require ...

tony.kay00:10:36

but I cannot reproduce it that way once restarted

richiardiandrea00:10:57

Also noticed sometimes the watch does not report the error, it prints "Error:" that's it

richiardiandrea00:10:45

Since version .12 will try to repro

thheller07:10:45

@tony.kay which version are you on? I removed the :e from the :build-failure message precisely because of those errors

thheller08:10:21

btw can you please try (pr-str (ex-info "foo" {:bar 1})) in your project? I don't understand why :e would not print as #error .... It seems like something is messing with the default printing setup?

tony.kay12:10:11

2.6.8 is the version that did that particular case

tony.kay12:10:29

I’ll upgrade and watch for future problems

thheller12:10:03

IIRC @wilkerlucio reported a similar issue a while back (bad exception printing) but I could never reproduce it

tony.kay12:10:48

it is strange, which is why I’ve held off…it dies in ways I can never repro either

thheller12:10:37

is this with just shadow-cljs running standalone or is there some server stuff as well?

thheller12:10:48

ie embedded in lein/deps?

wilkerlucio12:10:54

yeah, I still have it, at the nubank project I always have to get errors on the console

wilkerlucio12:10:10

in my case just shadow, no server things

wilkerlucio12:10:19

I just got one, let me paste here too

wilkerlucio12:10:40

env.cljs:167 failed to parse websocket message {:type :build-failure, :report "------ ERROR -------------------------------------------------------------------\n File: /Users/wilker.lucio/Development/nubank/shuffle/src-common/nubank/shuffle/modules/logistic/components.cljs:55:43\n--------------------------------------------------------------------------------\n  52 |           (ui/text-field {::ui/target this ::ui/attr :address/postcode :classes [:$margin-right-12]})\n  53 |           (ui/text-field-raw {:maxLength \"8\"\n  54 |                               :value     postcode-lookup\n  55 |                               :onChange  })\n-------------------------------------------------^------------------------------\nnubank/shuffle/modules/logistic/components.cljs [line 55, col 43] The map literal starting with :maxLength on line 53 column 30 contains 5 form(s). Map literals must contain an even number of forms.\n\n--------------------------------------------------------------------------------\n  56 |           (ui/text-field {::ui/target this ::ui/attr :address/postcode :classes [:$margin-right-12]})\n  57 |           (ui/button {:onClick #(let [postcode (-> this fp/props :address/postcode)]\n  58 |                                   (if (= 8 (count postcode))\n  59 |                                     (db.h/load this (fp/get-ident this) AddressForm {:params {:abrams.api/extra-attrs {:address.brazil/postcode postcode}}}))\n--------------------------------------------------------------------------------\n", :e clojure.lang.ExceptionInfo: failed to compile resource: [:shadow.build.classpath/resource "nubank/shuffle/modules/logistic/components.cljs"] {:ex-kind :reader-error, :source-excerpt {:start-idx 51, :before ["          (ui/text-field {::ui/target this ::ui/attr :address/postcode :classes [:$margin-right-12]})" "          (ui/text-field-raw {:maxLength \"8\"" "                              :value     postcode-lookup"], :line "                              :onChange  })", :after ["          (ui/text-field {::ui/target this ::ui/attr :address/postcode :classes [:$margin-right-12]})" "          (ui/button {:onClick #(let [postcode (-> this fp/props :address/postcode)]" "                                  (if (= 8 (count postcode))" "                                    (db.h/load this (fp/get-ident this) AddressForm {:params {:abrams.api/extra-attrs {:address.brazil/postcode postcode}}}))"]}, :file #object[java.io.File 0x396f9cf3 "/Users/wilker.lucio/Development/nubank/shuffle/src-common/nubank/shuffle/modules/logistic/components.cljs"], :resource-id [:shadow.build.classpath/resource "nubank/shuffle/modules/logistic/components.cljs"], :ex-type :reader-exception, :column 43, :line 55, :url #object[java.net.URL 0x37a875ae "file:/Users/wilker.lucio/Development/nubank/shuffle/src-common/nubank/shuffle/modules/logistic/components.cljs"], :source-id [:shadow.build.classpath/resource "nubank/shuffle/modules/logistic/components.cljs"], :tag :shadow.build.compiler/compile-cljs}, :build-id :workspaces} #error {:message "Invalid symbol: cloj … lang.ExceptionInfo:.", :data {:type :reader-exception, :ex-kind :reader-error}}
shadow$cljs$devtools$client$env$process_ws_msg @ env.cljs:167
(anonymous) @ browser.cljs:344
`

thheller12:10:12

yeah same thing :e clojure.lang.ExceptionInfo: failed to compile resource:

wilkerlucio12:10:17

this I think is the important bit, seems like what Tony described:

#error {:message 
"Invalid symbol: cloj … lang.ExceptionInfo:."
Invalid symbol: clojure.lang.ExceptionInfo:.
, :data {:type :reader-exception, :ex-kind :reader-error}}

wilkerlucio12:10:19

yeah, exactly

thheller12:10:26

can you quickly run a shadow-cljs clj-repl to that process?

thheller12:10:44

and see if (pr-str (ex-info "foo" {:bar 1})) prints as #error ...?

wilkerlucio12:10:00

ok, checking it out

thheller12:10:14

btw if you upgrade that issue should be gone

thheller12:10:20

:e is no longer part of that message

wilkerlucio12:10:41

[1:0]~shadow.user=> (pr-str (ex-info "foo" {:bar 1}))
"#error {\n :cause \"foo\"\n :data {:bar 1}\n :via\n [{:type clojure.lang.ExceptionInfo\n   :message \"foo\"\n   :data {:bar 1}\n   :at [clojure.core$ex_info invokeStatic \"core.clj\" 4739]}]\n :trace\n [[clojure.core$ex_info invokeStatic \"core.clj\" 4739]\n  [clojure.core$ex_info invoke \"core.clj\" 4739]\n  [shadow.user$eval33297 invokeStatic \"form-init8724609811994379936.clj\" 1]\n  [shadow.user$eval33297 invoke \"form-init8724609811994379936.clj\" 1]\n  [clojure.lang.Compiler eval \"Compiler.java\" 7062]\n  [clojure.lang.Compiler eval \"Compiler.java\" 7025]\n  [clojure.core$eval invokeStatic \"core.clj\" 3206]\n  [clojure.core$eval invoke \"core.clj\" 3202]\n  [shadow.cljs.devtools.server.socket_repl$repl$fn__17857 invoke \"socket_repl.clj\" 97]\n  [clojure.main$repl$read_eval_print__8572$fn__8575 invoke \"main.clj\" 243]\n  [clojure.main$repl$read_eval_print__8572 invoke \"main.clj\" 243]\n  [clojure.main$repl$fn__8581 invoke \"main.clj\" 261]\n  [clojure.main$repl invokeStatic \"main.clj\" 261]\n  [clojure.main$repl doInvoke \"main.clj\" 177]\n  [clojure.lang.RestFn invoke \"RestFn.java\" 805]\n  [shadow.cljs.devtools.server.socket_repl$repl invokeStatic \"socket_repl.clj\" 64]\n  [shadow.cljs.devtools.server.socket_repl$repl invoke \"socket_repl.clj\" 28]\n  [shadow.cljs.devtools.server$from_cli$fn__19792 invoke \"server.clj\" 606]\n  [shadow.cljs.devtools.server$from_cli invokeStatic \"server.clj\" 605]\n  [shadow.cljs.devtools.server$from_cli invoke \"server.clj\" 517]\n  [clojure.lang.AFn applyToHelper \"AFn.java\" 160]\n  [clojure.lang.AFn applyTo \"AFn.java\" 144]\n  [clojure.lang.Var applyTo \"Var.java\" 702]\n  [clojure.core$apply invokeStatic \"core.clj\" 657]\n  [clojure.core$apply invoke \"core.clj\" 652]\n  [shadow.cljs.devtools.cli$lazy_invoke invokeStatic \"cli.clj\" 22]\n  [shadow.cljs.devtools.cli$lazy_invoke doInvoke \"cli.clj\" 19]\n  [clojure.lang.RestFn invoke \"RestFn.java\" 460]\n  [shadow.cljs.devtools.cli$blocking_action invokeStatic \"cli.clj\" 148]\n  [shadow.cljs.devtools.cli$blocking_action invoke \"cli.clj\" 135]\n  [shadow.cljs.devtools.cli$main invokeStatic \"cli.clj\" 196]\n  [shadow.cljs.devtools.cli$main doInvoke \"cli.clj\" 151]\n  [clojure.lang.RestFn applyTo \"RestFn.java\" 137]\n  [clojure.core$apply invokeStatic \"core.clj\" 661]\n  [clojure.core$apply invoke \"core.clj\" 652]\n  [shadow.cljs.devtools.cli$_main invokeStatic \"cli.clj\" 238]\n  [shadow.cljs.devtools.cli$_main doInvoke \"cli.clj\" 236]\n  [clojure.lang.RestFn invoke \"RestFn.java\" 421]\n  [clojure.lang.Var invoke \"Var.java\" 385]\n  [user$eval543 invokeStatic \"form-init8724609811994379936.clj\" 1]\n  [user$eval543 invoke \"form-init8724609811994379936.clj\" 1]\n  [clojure.lang.Compiler eval \"Compiler.java\" 7062]\n  [clojure.lang.Compiler eval \"Compiler.java\" 7052]\n  [clojure.lang.Compiler load \"Compiler.java\" 7514]\n  [clojure.lang.Compiler loadFile \"Compiler.java\" 7452]\n  [clojure.main$load_script invokeStatic \"main.clj\" 278]\n  [clojure.main$init_opt invokeStatic \"main.clj\" 280]\n  [clojure.main$init_opt invoke \"main.clj\" 280]\n  [clojure.main$initialize invokeStatic \"main.clj\" 311]\n  [clojure.main$null_opt invokeStatic \"main.clj\" 345]\n  [clojure.main$null_opt invoke \"main.clj\" 342]\n  [clojure.main$main invokeStatic \"main.clj\" 424]\n  [clojure.main$main doInvoke \"main.clj\" 387]\n  [clojure.lang.RestFn applyTo \"RestFn.java\" 137]\n  [clojure.lang.Var applyTo \"Var.java\" 702]\n  [clojure.main main \"main.java\" 37]]}"

thheller12:10:12

hmm looks like it should

thheller12:10:30

no idea why it doesn't when printing for the websocket msg

wilkerlucio12:10:06

do you use transit for the encoding? because I learned that you can have generic handlers to have "default handlers" to encode things that transit doesn't understand, that could fix some encoding issues

thheller12:10:30

just pr-str in this case

wilkerlucio12:10:39

I was in the latest version already :thinking_face:

wilkerlucio12:10:10

maybe that could change, transit encoding is also faster than pr-str

thheller12:10:22

hmm that can't be?

wilkerlucio12:10:30

what can't be?

thheller12:10:47

I removed the :e from the :build-failure message

thheller12:10:59

there should be no way it ends up in the websocket message?

wilkerlucio12:10:02

ah, sorry, again I forgot to update the lein -.-

wilkerlucio12:10:04

let me do that

thheller12:10:50

I could change it to transit but I've been trying to keep dependencies to a minimum given that the code is injected into the build

wilkerlucio12:10:56

yeah, makes sense, but the gain can be noticable, when I was testing speed of things for the Fulcro Inspect encoding to send Fulcro data, transit sometimes gets up to 2~3x faster than pr-str on my tests

thheller12:10:39

yeah I know. EDN is quite slow

wilkerlucio13:10:42

hey, I just got this:

wilkerlucio13:10:44

[:workspaces] Build failure:

wilkerlucio13:10:49

it fail and gets stuck

wilkerlucio13:10:55

I had the same yesterday, both on the latest version

thheller13:10:21

hmm nothing else?

wilkerlucio13:10:35

no, it gets stuck after that, no more printing

thheller13:10:52

hehe doh .. that code is still accessing :e of course ...

thheller13:10:16

try compiling from the UI

thheller13:10:22

that should display the real error properly

wilkerlucio13:10:10

its not every time

wilkerlucio13:10:23

but now I got the correct HUD on my compilation 😄

wilkerlucio13:10:25

for the error

wilkerlucio13:10:55

ok, HUD is working fine now in the latest

wilkerlucio13:10:49

started working on HUD, stopped on console 😛

thheller13:10:02

yeah just fixed the console

wilkerlucio13:10:22

nice, so happy to see the HUD error back again, thank you! 😄

haywood16:10:56

I have a shadow build that outputs to target: npm-module which I import into react storybook (which has it's own server and index.html runner). I'm trying to get the browser repl working for this build, is there a javascript file I need to import into the foreign index.html?

haywood16:10:06

I'm not sure it's even possible

thheller16:10:31

@haywood its not gonna be very reliable you you need to load the shadow.cljs.devtools.client.browser namespace

thheller16:10:43

may need to set :runtime :browser in your config so it gets compiled

thheller16:10:44

require("./path-to/shadow.cljs.devtools.client.browser")

haywood16:10:59

roger, will try thanks!

haywood16:10:37

nice, I just had to import it into my project's core.cljs file

haywood16:10:40

and all works

thheller16:10:01

problem with that is that release will also include it then

haywood16:10:09

it's just a development tool anyway

thheller16:10:18

ah thats ok then

wilkerlucio21:10:41

@thheller I'm having problems doing release builds with shadow 2.6.12:

thheller21:10:08

looks like an old closure compiler version?

wilkerlucio21:10:24

humm, could be

thheller21:10:31

should be [com.google.javascript/closure-compiler-unshaded "v20180910"]

wilkerlucio21:10:39

is there a easy place for me to find which are the current ones used by shadow?

thheller21:10:58

if you list shadow-cljs as your first dependency you should always be getting the correct versions

thheller21:10:06

(assuming you use project.clj)

thheller21:10:25

what are you doing that you get the old version in the first place?

wilkerlucio21:10:38

I'm in a bizarre situation that I have to support both shadow-cljs and lein cljsbuild (the later just to run old tests on phatomjs that I'm unable to proper compile/run with shadow, not shadow fault, previous setup was not very nice)

wilkerlucio21:10:51

just bumped both, but I still getting that error

wilkerlucio21:10:56

trying to clean .shadow-cljs and trying again

thheller21:10:23

just check lein deps :tree

thheller21:10:35

that issue won't be affected by whats in .shadow-cljs

thheller21:10:33

lein-cljsbuild may actually be messing with you deps an inject older versions

wilkerlucio21:10:07

I tried the deps :tree, the versions seem correct there

wilkerlucio21:10:17

and I'm trying to do the shadow release

wilkerlucio21:10:23

oh, when I bumped the cljs and closure I also had shadow downgraded and forgot to upgrade back facepalm trying again

markx22:10:32

When I make some changes to a function, do I have to save the file to make the changes effective? Eval the new function to repl doesn’t seem to do the job, so I’m wondering if this is expected or there’s something wrong with my setup

thheller22:10:56

depends on what you mean by "make the changes effective"

markx22:10:58

I was hoping for something like, when I change the return value in get-x from 1 to 2 and eval get-x into repl, the console will start to log 2 instead of 1.

(defn get-x [] 1)
(defn loop []
   (js/console.log (get-x)
  (loop))

thheller08:10:42

depends on how you do the loop? can't do it like that because that will forever block the main thread so nothng else ever happens

markx20:10:05

So it will work if I don’t block the thread?

(defn loop []
   (js/console.log (get-x)
  (js/setTimtout loop 0))

thheller22:10:13

if you just eval the function you just get a new function. nothing else happens.

thheller22:10:28

thats unlike live-reload where there is an entire lifecycle of stuff that also happens

thheller22:10:50

ie. calling the after-load hook to re-render in case you are using reagent or so

thheller22:10:02

that hook isn't called if you just eval a function?