Fork me on GitHub
Shako Farhad05:04:56

Does anyone else have issues with using auto-animate? I can't get to resolve the dependancies no matter how much I try. I followed this guide: Required it like this: ["@formkit/auto-animate/react" _:refer_ [useAutoAnimate]] and ["@formkit/auto-animate/react$default" _:refer_ [useAutoAnimate]] and many other ways, but always got this error: "The required JS dependency "@formkit/auto-animate/react" is not available," Then I tried to add this to my shadow-cljs.edn directly: _:js-options_ {_:resolve_ {"@formkit/auto-animate/react" {_:target :npm :require_ "@formkit/auto-animate/react/index.d.ts"}}} But that just gave me this error: Errors encountered while trying to parse file /home/dev/src/mono/bec-core-client/node_modules/@formkit/auto-animate/react/index.d.ts {:line 8, :column 7, :message "'async' expected"} By the way, this works: ["@formkit/auto-animate" _:as_ auto-animate] But of course that is not useful by itself. Anyone know how to properly import it with shadow-cljs and npm?


the :resolve part is definitely wrong. .d.ts files are just the typescript type definitions, not the actual source. so they are useless and not supported

Shako Farhad05:04:18

Ok. I didn't know that. When I look at the code there are two kinds of files in the react folder. index.d.ts and index.mjs


it appears the extension only uses mjs files, you can set :js-options {:extensions [".js" ".mjs" ".json"]} in the build config


that might be enough

Shako Farhad06:04:52

Yes that seems to have fixed it! What does it do exactly? It now also accepts .mjs and before it didn't concider those files? IS that it?

Fredrik Andersson20:04:50

I have a node-library target that compiles to functions/index.js. It's a firebase cloud functions project. The compilation works fine but after updating all node packages to latest I suddenly got this error when running the code with the emulator:

SHADOW import error /home/fredrik/src/percap-cljs/.shadow-cljs/builds/functions/dev/out/cljs-runtime/anr.login.functions.js
I can't figure out what is wrong


and what is the rest of the error? that is just telling you what failed to load, why should also be in there somewhere

Fredrik Andersson20:04:41

firebase gives this error:

⬢  functions: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: TypeError: Cannot read properties of null (reading 'memory')

Fredrik Andersson20:04:56

as a result from the SHADOW error

Fredrik Andersson20:04:40

the why is probably because the

doesn't exist


Cannot read properties of null (reading 'memory') suggests something else


but I don't know what you are doing, so can't suggest much

Fredrik Andersson20:04:14

Let me show you a larger output

Fredrik Andersson20:04:22

From the compiler

shadow-cljs - config: /home/fredrik/src/percap-cljs/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.20.1 running at 
shadow-cljs - nREPL server started on port 42971
shadow-cljs - watching build :admin
shadow-cljs - watching build :functions
[:admin] Configuring build.
[:functions] Configuring build.
[:functions] Compiling ...
[:admin] Compiling ...
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: 
[BABEL] Note: The code generator has deoptimised the styling of /home/fredrik/src/percap-cljs/node_modules/@firebase/firestore/dist/index.esm2017.js as it exceeds the max of 500KB.
[:functions] Build completed. (169 files, 168 compiled, 0 warnings, 5.05s)
[:admin] Build completed. (346 files, 345 compiled, 0 warnings, 15.19s)

Fredrik Andersson20:04:05

Full output from emulator:

> emulators
> firebase emulators:start

i  emulators: Starting emulators: auth, functions, firestore, hosting, pubsub, storage
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  pubsub: Pub/Sub Emulator logging to pubsub-debug.log
i  hosting[admin]: Serving hosting files from: dist/admin
✔  hosting[admin]: Local server: 
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/home/fredrik/src/percap-cljs/functions" for Cloud Functions...
✔  functions: Using node@16 from host.
i  functions: Loaded environment variables from .env.percap-cljs.
SHADOW import error /home/fredrik/src/percap-cljs/.shadow-cljs/builds/functions/dev/out/cljs-runtime/anr.login.functions.js
⬢  functions: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: TypeError: Cannot read properties of null (reading 'memory')

│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at                │

│ Emulator       │ Host:Port      │ View in Emulator UI             │
│ Authentication │ │       │
│ Functions      │ │  │
│ Firestore      │ │  │
│ Hosting        │ │ n/a                             │
│ Pub/Sub        │ │ n/a                             │
│ Storage        │ │    │
  Emulator Hub running at
  Other reserved ports: 4500, 9150

Issues? Report them at  and attach the *-debug.log files.

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
⚠  Emulator UI has exited upon receiving signal: SIGINT
i  functions: Stopping Functions Emulator
i  hosting: Stopping Hosting Emulator
i  firestore: Stopping Firestore Emulator
i  pubsub: Stopping Pub/Sub Emulator
i  auth: Stopping Authentication Emulator
i  storage: Stopping Storage Emulator
⚠  Pub/Sub Emulator has exited upon receiving signal: SIGKILL
i  eventarc: Stopping Eventarc Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator


looks like the emulator is hiding the relevant output? don't know anything about that setup, so can't help much

Fredrik Andersson20:04:35

ok, ill see if i can find anything else


does a release build work?


maybe that gives a more useful error


maybe with npx shadow-cljs release functions --pseudo-names

Fredrik Andersson20:04:34

first im going to revert all packages to previous versions and see if that helps


that seems like more work than trying a release build 😉

Fredrik Andersson20:04:44

yeah, but i had already started so I have to finish 😅

Fredrik Andersson20:04:40

now I got a better error

Fredrik Andersson20:04:54

i  functions: Watching "/home/fredrik/src/percap-cljs/functions" for Cloud Functions...
>  SHADOW import error /home/fredrik/src/percap-cljs/.shadow-cljs/builds/functions/dev/out/cljs-runtime/anr.login.functions.js
⚠  TypeError: Cannot read properties of null (reading 'memory')
    at assertRuntimeOptionsValid (/home/fredrik/src/percap-cljs/functions/node_modules/firebase-functions/lib/function-builder.js:43:24)
    at Proxy.runWith (/home/fredrik/src/percap-cljs/functions/node_modules/firebase-functions/lib/function-builder.js:182:9)
    at Function.cljs$core$IFn$_invoke$arity$2 (/home/fredrik/src/percap-cljs/.shadow-cljs/builds/functions/dev/out/cljs-runtime/anr/fire/functions.cljs:19:8)
    at Function.cljs$core$IFn$_invoke$arity$1 (/home/fredrik/src/percap-cljs/.shadow-cljs/builds/functions/dev/out/cljs-runtime/anr/fire/functions.cljs:17:11)
    at /home/fredrik/src/percap-cljs/.shadow-cljs/builds/functions/dev/out/cljs-runtime/anr/login/functions.cljs:51:3
    at global.SHADOW_IMPORT (/home/fredrik/src/percap-cljs/functions/index.js:70:44)
    at /home/fredrik/src/percap-cljs/functions/index.js:1517:1
    at /home/fredrik/src/percap-cljs/functions/index.js:5:26
    at Object.<anonymous> (/home/fredrik/src/percap-cljs/functions/index.js:9:3)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
⚠  We were unable to load your functions code. (see above)

Fredrik Andersson20:04:06

From the compiler

shadow-cljs - config: /home/fredrik/src/percap-cljs/shadow-cljs.edn
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.23.2 running at 
shadow-cljs - nREPL server started on port 37427
shadow-cljs - watching build :functions
[:functions] Configuring build.
[:functions] Compiling ...
[:functions] Build completed. (171 files, 1 compiled, 0 warnings, 1.64s)
Exception in thread "async-dispatch-5" UT002002: Channel is closed
	at io.undertow.websockets.core.WebSocketChannel.send(
	at io.undertow.websockets.core.WebSockets.sendBlockingInternal(
	at io.undertow.websockets.core.WebSockets.sendBlockingInternal(
	at io.undertow.websockets.core.WebSockets.sendTextBlocking(
	at shadow.undertow$fn$reify__17448$fn__17572$state_machine__6615__auto____17611$fn__17614.invoke(undertow.clj:468)
	at shadow.undertow$fn$reify__17448$fn__17572$state_machine__6615__auto____17611.invoke(undertow.clj:468)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:978)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:977)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:982)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:980)
	at shadow.undertow$fn$reify__17448$fn__17572.invoke(undertow.clj:468)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at clojure.core.async.impl.concurrent$counted_thread_factory$reify__484$fn__485.invoke(concurrent.clj:29)
	at java.base/

Fredrik Andersson20:04:45

but i suppose thats just the repl


thats likely the websocket dying because the process getting killed or something yes


so what are you doing in line 17?


looks to me like you are passing an invalid argument or so to a firebase thing

Fredrik Andersson20:04:28

(defn https ([fun] (https nil fun)) ([runwith fun] (-> functions (.runWith (clj->js runwith)) region (.-https) (.onRequest fun))))

Fredrik Andersson20:04:46

yes, I am aparently