binaryage / chromex

Write Chrome Extensions in ClojureScript
Other
411 stars 21 forks source link

Error: goog.isBoolean is not a function #24

Closed eliascotto closed 2 years ago

eliascotto commented 2 years ago

I created a new chromex extension using this template with shadow-cljs. Building it I'm getting that error in the background file on the startup.

TypeError: goog.isBoolean is not a function at Object.oops$core$validate_object_access_dynamically [as validate_object_access_dynamically]

Debugging, I found that this portion is generating the error.

(defn boot-chrome-event-loop! []
  (let [chrome-event-channel (make-chrome-event-channel (chan))]
    (web-navigation/tap-on-completed-events chrome-event-channel)
    ^^^ Error on this line
    (run-chrome-event-loop! chrome-event-channel)))

With this macro call inside

(defn ^boolean validate-object-access-dynamically [obj mode key push? check-key-read? check-key-write?]
  (runtime/validate-object-access-dynamically obj mode key push? check-key-read? check-key-write?))

I know from this issue that the problem is related to the version of clojurescript used.

This is my deps.edn file and if I'm not wrong, chromex 0.9.2 uses at least version 1.10.844 where goog.isBoolean has been removed.

{:paths ["src/background"
         "src/popup"
         "src/content_script"

         ; this is just a temporary override of shadow-cljs behaviour
         ; https://clojurians.slack.com/archives/C6N245JGG/p1581362714447400 for further discussion
         "src/shadow-hacks"]

 :deps  {org.clojure/clojure             {:mvn/version "1.10.3"}
         org.clojure/clojurescript       {:mvn/version "1.11.4"}
         com.github.seancorfield/clj-new {:mvn/version "1.2.381"}
         binaryage/devtools              {:mvn/version "1.0.4"}
         binaryage/chromex               {:mvn/version "0.9.2"}
         ; ---
         thheller/shadow-cljs            {:mvn/version "2.17.5"}}}
madis commented 2 years ago

Similar problem here. I'm loading the dependencies via deps.edn but Clojure, CLJS and shadow-cljs are all most recent versions. Any advice? Or where should the fix come from?

{:paths ["src"]
 :mvn/repos {"central" {:url "https://repo1.maven.org/maven2/"}
             "clojars" {:url "https://clojars.org/repo"}}
 :deps {
        org.clojure/clojure {:mvn/version "1.10.3"}
        org.clojure/clojurescript {:mvn/version "1.11.4"}
        thheller/shadow-cljs {:mvn/version "2.17.5"}

        binaryage/devtools {:mvn/version "1.0.3"}
        re-frisk/re-frisk {:mvn/version "1.5.1"}
        cljsjs/react {:mvn/version "17.0.2-0"}
        re-frame/re-frame {:mvn/version "1.2.0"}
        reagent/reagent {:mvn/version "1.1.0"}

        ; Vim Iced deps
        refactor-nrepl/refactor-nrepl {:mvn/version "3.3.2"}
        cider/cider-nrepl {:mvn/version "0.28.2"}
        com.github.liquidz/iced-nrepl {:mvn/version "1.2.8"}

        cljs-web3-next/cljs-web3-next {:local/root "../district0x/cljs-web3-next"}
        }}

Screenshot from 2022-03-03 14-30-32

eliascotto commented 2 years ago

@madis Clojurescript has been updated to 1.10.844 but without a release, so Clojure is downloading the old release 0.9.2 with an incompatible cljs dependency.

I found a temporary solution, fork the repo and create a new release. It will remove the message once you replaced the repo in deps.edn as

io.github.elias94/chromex {:git/tag "v0.9.3" :git/sha "73bf909"}

@darwin Is possible to create a new release 0.9.3?

darwin commented 2 years ago

Done! Hope this helps.