Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build with example setup fails: goog.debug.Logger.level missing, required by fulcro/logging.cljc #65

Open
mathiasp opened this issue Feb 13, 2022 · 6 comments

Comments

@mathiasp
Copy link

From what I learned, google closure and cljs removed that api, but fulcro2 still depends on it.

I've just set up a project and ran into this:

mathiasp:~/Projekte/helix-play% cat shadow-cljs.edn 
;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 :dependencies
 [[nubank/workspaces "1.1.2"]]

 :builds
 {:cards {:target     nubank.workspaces.shadow-cljs.target
          :ns-regexp  "-(test|cards)$"
          :output-dir "resources/public/js/workspaces"
          :asset-path "/js/workspaces"
          :preloads   [] ; optional, list namespaces to be pre loaded
          }}}
mathiasp:~/Projekte/helix-play% npx shadow-cljs watch cards          
shadow-cljs - config: /home/mathiasp/Projekte/helix-play/shadow-cljs.edn
shadow-cljs - server version: 2.17.2 running at http://localhost:9630
shadow-cljs - nREPL server started on port 30982
shadow-cljs - watching build :cards
[:cards] Configuring build.
[:cards] Compiling ...
[:cards] Build failure:
The required namespace "goog.debug.Logger.Level" is not available, it was required by "fulcro/logging.cljc".

This is with node 14 & 17 and OpenJDK 17.

I'm not really experienced with cljs and node dependency handling, any tips on how I can get around this?

Any help apreciated,

Mathias

@whacked
Copy link

whacked commented May 5, 2022

I just hit this issue as well.

By using this js-options I'm able to get to Build completed. for the cards target as given in the README (like what @mathiasp has above)

:cards {:target     nubank.workspaces.shadow-cljs.target                                 
        :ns-regexp  "-(test|cards)$"
        :output-dir "public/js/workspaces"
        :asset-path "/js/workspaces"
        :preloads   [] ; optional, list namespaces to be pre loaded
        :js-options {:resolve {"goog.debug.Logger.Level"
                               {:target :global
                                :global "goog.log.Logger.Level"}}},
        }

however, this does not make the workspaces usable. Loading the workspaces file leads to these errors:

main.js:1425 TypeError: Cannot read properties of undefined (reading 'extend')
    at eval (dom_history_viewer.cljs:20:1)
    at eval (<anonymous>)
    at Object.goog.globalEval (main.js:472:11)
    at Object.env.evalLoad (main.js:1533:12)
    at main.js:1778:12
reportError @ main.js:1425
env.evalLoad @ main.js:1535
(anonymous) @ main.js:1778

it's not yet clear whether this means the logger fix is incorrect, or that this is a different problem.

@whacked
Copy link

whacked commented May 5, 2022

I believe the resolve method is the wrong approach, and the problem is at the build tool level (google closure or shadow-cljs related).

For me, this builds correctly after downgrading from shadow-cljs 2.18.0 to 2.14.x 2.15.12. anything at or above 2.15.x will throw the failure

The required namespace "goog.debug.Logger.Level" is not available, it was required by "fulcro/logging.cljc".

I have added some more information and a minimal working example here

given the specificity of this breakage, it's likely related to this issue: thheller/shadow-cljs#980

@whacked
Copy link

whacked commented May 6, 2022

The resolve method is actually a working approach, but is incomplete. It successfully resolves the compile-time error and blockage. The error Cannot read properties of undefined (reading 'extend') is resolved by adding :global-goog-object&array true to :compiler-options. See my repo for a complete working minimal example.

These are tooling-side changes. For code-side changes:

  • workspaces simultaneously depends on fulcro 2 (fulcrologic/fulcro "2.6.16") and fulcro 3 (com.fulcrologic/fulcro "3.0.5")
  • The goog.debug.Logger.Level stuff is caused by fulcro 2. The problem might go away

I tried to look into what it takes to move, but it didn't look easy to me.

  • this is a shadow-cljs project that delegates its dependency loads via the :deps option, so it loads deps.edn
  • running shadow-cljs as-is, I keep hitting this error
shadow-cljs - config: /tmp/workspaces/shadow-cljs.edn
shadow-cljs - starting via "clojure"
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: requiring-resolve in this context, compiling:(shadow/cljs/devtools/cli.clj:70:16)

this error seems associated with clojure 1.9, but this error happens on a blank system with a fresh clojure 1.11 installation, so I stopped there

  • removing :deps brings dependency control back into shadow-cljs only, but it bails after
shadow-cljs - config: /tmp/workspaces/shadow-cljs.edn
WARNING: The org.clojure/core.async dependency in shadow-cljs.edn was ignored. Default version is used and override is not allowed to ensure compatibility.
The versions provided by shadow-cljs can be found here: https://clojars.org/thheller/shadow-cljs/versions/2.18.0
Exception in thread "main" java.lang.ExceptionInInitializerError
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
...
Caused by: java.lang.Exception: Cyclic load dependency: [ /clojure/spec/alpha ]->/clojure/spec/gen/alpha->[ /clojure/spec/alpha ]->/clojure/main->/clojure/core/server

so for now, the easiest method I have is by including the [nubank/workspaces "1.1.2"] dependency directly, and applying the compiler level fixes as detailed above.

@evaogbe
Copy link

evaogbe commented Jun 5, 2022

What does this mean "including the [nubank/workspaces "1.1.2"] dependency directly"? What file do I put it in?

@whacked
Copy link

whacked commented Jun 6, 2022

put it in shadow-cljs :dependencies; this should provide a minimal working configuration

@evaogbe
Copy link

evaogbe commented Jun 11, 2022

Thank you I was able to get it to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants