0

I am writing a cljs library from scratch (i.e. without a leiningen template). Using lein figwheel, Figwheel successfully compiles my cljs into JS, but doesn't fully connect to my application because of the following three errors that show up in the console:

Uncaught TypeError: Cannot read property 'call' of undefined
    at utils.cljs?rel=1627878774806:73
Uncaught TypeError: Cannot read property 'call' of undefined
    at Function.cljs$core$IFn$_invoke$arity$3 (async.cljs?rel=1627878780415:57)
    at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
    at Function.cljs$core$IFn$_invoke$arity$1 (async.cljs?rel=1627878780415:54)
    at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
    at Function.cljs$core$IFn$_invoke$arity$0 (async.cljs?rel=1627878780415:53)
    at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
    at file_reloading.cljs?rel=1628044048652:338
Uncaught TypeError: Cannot read property 'call' of undefined
    at Function.cljs$core$IFn$_invoke$arity$3 (async.cljs?rel=1627878780415:57)
    at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
    at Function.cljs$core$IFn$_invoke$arity$1 (async.cljs?rel=1627878780415:54)
    at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
    at Function.cljs$core$IFn$_invoke$arity$0 (async.cljs?rel=1627878780415:53)
    at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
    at figwheel$client$file_reloader_plugin (client.cljs?rel=1628044052054:150)
    at figwheel$client$add_plugins (client.cljs?rel=1628044052054:451)
    at client.cljs?rel=1628044052054:473

Here is my core.cljs:

(ns cljs-spotify-sdk.core)

(defn load-sdk []
  (let [script-id "spotifySDK"]
    (when-not (. js/document (getElementById script-id))
      (let [script (. js/document (createElement "script"))]
        (-> script (.-id) (set! script-id))
        (-> script (.-type) (set! "text/javascript"))
        (-> script (.-async) (set! true))
        (-> script (.-src) (set! "//sdk.scdn.co/spotify-player.js"))
        (let [first-js (-> js/document (.getElementsByTagName "script") (aget 0))
              parent (.-parentNode first-js)]
          (.insertBefore parent script first-js)))))
  (.log js/console "SDK script inserted"))

How can I resolve these errors?

duplic8
  • 109
  • 1
  • 9

0 Answers0