This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-29
Channels
- # announcements (1)
- # babashka (120)
- # beginners (184)
- # cider (14)
- # clara (2)
- # clj-kondo (25)
- # cljfx (9)
- # cljsrn (43)
- # clojure (46)
- # clojure-australia (2)
- # clojure-berlin (5)
- # clojure-dev (2)
- # clojure-europe (10)
- # clojure-france (3)
- # clojure-nl (1)
- # clojure-spec (14)
- # clojure-uk (30)
- # clojurescript (50)
- # code-reviews (19)
- # conjure (11)
- # core-logic (2)
- # cursive (20)
- # datascript (1)
- # datomic (74)
- # figwheel-main (1)
- # fulcro (10)
- # funcool (2)
- # graphql (1)
- # lambdaisland (1)
- # malli (2)
- # meander (22)
- # nrepl (13)
- # off-topic (28)
- # overtone (3)
- # pathom (7)
- # pedestal (4)
- # re-frame (4)
- # reagent (16)
- # reitit (4)
- # releases (1)
- # ring (8)
- # shadow-cljs (93)
- # specter (6)
- # sql (13)
- # test-check (1)
- # tools-deps (1)
- # tree-sitter (2)
- # vim (8)
- # xtdb (25)
Hi everyone. May I please get some advice on how to debug an AssertionError Assert failed: (rc/valid-resource-id? src-id) shadow.cljs.devtools.server.worker.impl/eval17300/fn--17303/fn--17306 (impl.clj:808)
error? :shadow.cljs.devtools.server.util/handle-ex
reports {:msg {:op :cljs-load-sources, :sources [[:shadow.build.classpath/resource "common/lists.cljc"]...
and :sources
seems to include a nil which I presume is causing the problem. Unfortunately I can't quite work out what's causing the nil.
(The error happens when I try to evaluate anything once connected to the browser cljs repl)
@clojure475 what are you trying to eval? and please do not shorten errors. I need the full stacktrace to make sense of it
Thanks for reply Thomas. It seems to happen when I try to eval anything, even a plain keyword.
The setup is a bit complicated (`shadow-cljs.edn` pointing at deps.edn
aliases etc) but has been working brilliantly until I made too many changes without testing stepwise.
Output
:a
[2020-09-29 20:04:36.176 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:op :cljs-load-sources, :sources [[:shadow.build.classpath/resource "common/lists.cljc"] [:shadow.build.classpath/resource "common/allocations.cljc"] [:shadow.build.classpath/resource "test/tools.cljc"] [:shadow.build.classpath/resource "test/examples.cljc"] [:shadow.build.classpath/resource "test/common/allocations.cljc"] [:shadow.build.classpath/resource "test/common/api.cljc"] [:shadow.build.classpath/resource "test/common/appointments.cljc"] [:shadow.build.classpath/resource "test/common/dates.cljc"] [:shadow.build.classpath/resource "test/common/fsm.cljc"] [:shadow.build.classpath/resource "test/common/lists.cljc"] [:shadow.build.classpath/resource "test/common/message.cljc"] nil [:shadow.build.classpath/resource "test/common/core.cljc"] [:shadow.build.npm/resource "node_modules/react/cjs/react.production.min.js"] [:shadow.build.classpath/resource "test/client/events/requests.cljs"] [:shadow.build.classpath/resource "test/client/core.cljs"] [:shadow.build.npm/resource "node_modules/scheduler/cjs/scheduler.production.min.js"] [:shadow.build.npm/resource "node_modules/react-dom/cjs/react-dom.production.min.js"] [:shadow.build.npm/resource "node_modules/scheduler/cjs/scheduler-tracing.production.min.js"] [:shadow.build.npm/resource "node_modules/react-is/cjs/react-is.production.min.js"] [:shadow.build.npm/resource "node_modules/prop-types/factoryWithThrowingShims.js"] [:shadow.build.classpath/resource "cljs/user.cljs"]], :call-id 5, :from 57}}
ExceptionInfo no output for id: [:shadow.build.classpath/resource "test/examples.cljc"] {:resource-id [:shadow.build.classpath/resource "test/examples.cljc"]}
shadow.build.data/get-output! (data.clj:197)
shadow.build.data/get-output! (data.clj:193)
shadow.cljs.devtools.server.worker.impl/eval17300/fn--17303/fn--17306 (impl.clj:813)
clojure.core/map/fn--5866 (core.clj:2753)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
clojure.lang.RT.seq (RT.java:535)
clojure.core/seq--5402 (core.clj:137)
clojure.core.protocols/seq-reduce (protocols.clj:24)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)
Timeout while waiting for result.
yep nrepl and yep thank you the version bump (as well as restarting repl, which I do fairly frequently) seems to have resolved the problem!š
In my project, I'm doing a normal + bootstrap build, and when I first launch shadow-cljs, I get a bunch of warnings about a provide conflict between the normal and bootstrap builds, like this:
[2020-09-29 09:40:52.675 - WARNING] provide conflict for #{goog.structs.Set} provided by web/js/bootstrap/js/goog.structs.set.js and {"/goog/structs/set.js" #{goog.structs.Set}}
So that's inferred or generated based on what, exactly? outdir-dir
? or asset-path
? I see no explicit classpath in my shadow-cljs.edn.
by classpath I'm referring to your :source-paths
and the :output-dir
being on said source path
My :source-paths
have my output dir on them - but if I remove it from source-paths and restart shadow-cljs, I get the same error.
So I ended up having that same issue in a project I was importing, which maybe seems to have been the source of the error.
Thanks for that - I'm not sure why my output dir was in the source paths to begin with.
well it is supposed to be filtered and ignored but it looks like it just doesn't filter bootstrap builds
Ok, well, thank you for the insight in any case. I prefer having no warnings coming from the build if I can!
Intro and context: We are reusing some code between our web app and our react-native app and for that we need to do some runtime checks. Unfortunately we also need to convince the compiler to play along. For web itās easy to stub out dependencies by using :js-options :resolve
with :target :global
.
So here comes the question: If we want to use :target :global
on react-native what is the best way to populate global? In our web app we can execute JS before the app runs, but on mobile I didnāt find a way to do so.
@ullrich.schaefer do you have an example of what you are stubbing out this way?
I made this example a while ago https://gist.github.com/thheller/fa044450a6470fdd1afdbcf3f37a65e3
A good example is Quill-js which is used in the main app to edit text. The mobile app is not concerned with editing text, but is including some namespaces that eventually end up importing quill.
Also our main app is still build without shadow in production so weāre restricted in how we can import namespaces. There we use :global-exports in deps.edn. We use shadow for dev though so we can just do :js-options {:resolve {"quill" {:target :global :global "quill"}}}
.
Quill is just one of many examples and it would be great not to have to restructure all code around those dependencies, but find a solution at build tool level.
you might want to look into :js-provider :external
if thats coming from webpack or so? only desribed here currently https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
as far as I understand for the react-native issue though you can probably just set :js-options {:resolve {"quill" false}}
that will make it just ignore that dependency entirely? not sure if you need the actual global?
Yes, thatās actually what weāre looking for. Weāll try that and Iāll report back to you. Sorry, but our setup is a bit complicated and grew a bit over the years š Our dependencies on web are loaded using an outdated approach called doublebundle, described https://presumably.de/double-bundle-integrating-npm-dependencis-into-clojurescript-projects.html. Certainly something we need to transition away from at some point. A lot of good things happened to the CLJS ecosystem over the last years. Shadow being one of them š š
@thheller Turned out it didnāt work because weāre not using shadow-style/double-quote imports (we have another app that is build using cljs with :target :bundle
Having some problems with my project after installing some npm dependencies Uncaught TypeError: Cannot read property 'hydrate' of undefined
(ns pwa.core
(:require [react-dom :as react-dom]
[reagent.core :as r]))
Why would react-dom be undefined here?
Is the reagent dependency somehow conflicting with the react/react-dom in package.json?
@danielstockton there is no use of hydrate
in the code you pasted so no clue how you are using it?
Sorry, just using it like this
(ns ^:figwheel-hooks pwa.core
(:require [pwa.shared :as shared]
[react-dom :as react-dom]
[reagent.core :as r]))
(defn mount [el]
(react-dom/hydrate (r/as-element [shared/root]) el))
Yeah, these problems started after i installed html-react-parser
for the server side part, which meant i also had to install react and react-dom with npm.
Have tried clearing node_modules completely and reinstalling multiple times, npm installing the same version as reagent (16.13.0)
ls node_modules/react-dom/
build-info.json index.js package.json README.md server.js test-utils.js unstable-fizz.browser.js unstable-fizz.node.js
cjs LICENSE profiling.js server.browser.js server.node.js umd unstable-fizz.js unstable-native-dependencies.js
react-dom folder not empty
if you haven't restarted shadow-cljs after running npm install
or so maybe try doing that
I've been banging my head against Calva and VSCode with shadow all day and I'm spent... anyone know why when I eval a namespace nothing seems to get loaded?
here's my shadow-cljs.edn
:
{:source-paths ["src"]
:dependencies [[cljs-ajax "0.8.0"]
[org.clojure/core.async "1.3.610"] ; ignored by shadow-cljs (embedded)
[funcool/cuerdas "2.2.0"]
[clojusc/defun "0.4.0"]
[frankiesardo/linked "1.3.0"]
[jamesmacaulay/cljs-promises "0.1.0"] ; FIXME: When batching cartography files: uncomment and `shadow-cljs pom`
;;[cider/cider-nrepl "0.23.0"] ; for Calva + Shadow-cljs
[net.cgrand/xforms "0.19.2"]]
:nrepl {:port 3333}
:builds {:lib {:target :node-library
:output-dir "public/census"
:output-to "public/census/census.js"
:compiler-options {:optimizations :advanced
:source-map-include-sources-content false}
:exports-var census.core/census}
:geo {:target :node-library
:output-dir "public/geo"
:output-to "public/geo/batch_convert.js"
:compiler-options {:optimizations :simple}
:exports-var configs.geojson.core/batch_convert}}}
... here's what I'm trying to load:
(ns configs.geojson.core
(:require
[cljs.core.async :refer [>! <! chan promise-chan close! take! put! pipeline-async]
:refer-macros [go go-loop]]
[cuerdas.core :refer [join]
:as s]
[clojure.set :refer [map-invert]]
[defun.core :refer-macros [defun]]
[cljs-promises.async :refer [value-port]] ;; Fixme: Need this dependecy -< move configs to separate project
[census.utils.core :refer [map-target error err-type]]
[configs.utils.core :refer [read-edn FileSaver]]
[configs.geojson.filepaths2018 :refer [paths]]
[clojure.reader :refer [read-string]]
["fs" :as fs]
["shpjs" :as shpjs]
["mkdirp" :as mkdirp]))
(def geoKeyMap (read-edn "./src/configs/geojson/index.edn"))
and here's what's eval'd:
clj::shadow.user=>
; Creating cljs repl session...
; Connecting cljs repl: shadow-cljs...
; The Calva Connection Log might have more connection progress information.
; Connected session: cljs, repl: node-repl
; TIPS: You can choose which REPL to use (clj or cljs):
; *Calva: Toggle REPL connection*
; (There is a button in the status bar for this)
cljs::cljs.user=>
; Evaluating file: core.cljs
; ------ WARNING - :redef --------------------------------------------------------
; Resource: <eval>:16:1
resolve already refers to: cljs.core/resolve being replaced by: cljs-promises.core/resolve
--------------------------------------------------------------------------------
nil
cljs::configs.geojson.core=>
#object[TypeError TypeError: Cannot read property 'core' of undefined]
cljs::configs.geojson.core=>
I've tried using a remote session and a straight "jack-in" workflow both using a build id as well as just a node-repl
I get the same no matter
@loganpowell the problem might be the warning
let me try without defun
sorry, that's what I meant
Q: has anyone ever done aws interop to implement x-ray tracing for the entire SDK as documented here https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-awssdkclients.html ? I canāt figure out the incantation for Shadow style interop
can't tell from the page since either example is missing code to understand what any of it means
I agree. Thatās part of my problem. Iām experimenting with it now, looking at the generated js to try and match it up. Iāll report back if/when I get it working
(sorry, by āincantationā, I meant āinterop formā. thatās me being too clever)
var AWS = AWSXRay.captureAWS(require('aws-sdk'));
that example doesn't explain where AWSXRay
is coming from
var ddb = AWSXRay.captureAWSClient(new AWS.DynamoDB());
that doesn't explain where AWS
is coming from
unless its supposed to be used together
var AWSXRay = require('aws-xray-sdk');
var AWS = AWSXRay.captureAWS(require('aws-sdk'));
var ddb = AWSXRay.captureAWSClient(new AWS.DynamoDB());
(ns foo.bar
(:require
["aws-xray-sdk" :as aws-xray]
["aws-sdk" :as aws-sdk]))
(def aws (aws-xray/captureAWS aws-sdk))
(def ddb (aws-xray/captureAWSClient (aws.DynamoDB.)))
yep, resolve already refers to: cljs.core/resolve being replaced by: cljs-promises.core/resolve
is the issue, when I remove that, smooth sailing. Is there a way to alias a function within a dependency like this?
thanks @thheller I figured it out. the confusing part was around calling the ānewā which is not very lispy. And yes, the AWS doc is not clear at all
the solution isā¦. use these 2 requires
["aws-sdk" :as aws-sdk-clean] ; clean means without x-ray
["aws-xray-sdk" :as aws-xray-sdk]
then use this form to wrap the sdk with xray
(let [capture-full-sdk (j/get aws-xray-sdk :captureAWS)]
(capture-full-sdk aws-sdk-clean))
then you can use this let form to construct a service client where aws-sdk is the wrapped sdk
[s3-client (j/get aws-sdk :S3)
s3 (new s3-client)]