Fork me on GitHub

@pshar10 the origin is client.cljs line 240?


That isn't helpful. client.cljs isn't one of my src files. That might be one from the template that I'm using


its in the browser console so you should be able to click it and it'll take you to the source?


Is there a way to get a cljs map or vector of a Javascript Object’s properties? I tried

(.entries js/Ojbect myObject)
But I always get an empty vector


it’s included by default with cljs


you may have to require something like [goog.object :as gobject]


and use (gobject/getKeys obj)


There's js-keys in core

Jakob Durstberger10:05:53

Morning, I tried adding a JS library to the re-frame template. I used npm install --save aws-amplify and then added ["aws-amplify" :as aws]. But the site doesn’t show anything and the console only shows the error:

reload-failed Error: Failed to load website/core.cljs: 
at Object.shadow$cljs$devtools$client$browser$do_js_load [as do_js_load]
Does anyone know what I am doing wrong? Edit: Hmm I can import math-random so I think it is an issue with aws-amplify itself 😞


that is the rest of that error?


or the one before/after it?


it failed to load website/core.cljs but that might be because an error in another file it depends on happened first


I was using it like:

    :refer [Hub]
    :default Amplify]
Depends a bit on what you want from the very large library. Also they recently dramatically changed the library in 3.x.x with the ability to load only the portion you want/need. That have some javascript examples in and I find this a good guide to translating the import statements to Clojure require:

👍 4

@jakob.durstberger I wrote up a tutorial on using Amplify Auth and re-frame It was pre amplify 3.x but I think its generally applicable still

👍 4
Jakob Durstberger04:05:19

I want to use the authentication part, I’ll have a look at your post. Thank you


That’s primarily what I covered

Jakob Durstberger06:05:47

I went through your blog post and my issue is that the auth UI is just not coming up. I use terraform to deploy my user pool so I think I might have misconfigured something. Out of interest, did you also write this one? They seem to be very very similar 😄

Oliver George10:05:12

Hi Jakob. Are you trying out the new webpack feature?

Jakob Durstberger10:05:31

Uhm, not that I am aware of. I think the re-frame template doesn’t use webpack

Oliver George10:05:38

Using node deps involves a bit of work. The most recent release opened up a new way but it's always been possible.

Oliver George10:05:17

Assuming it's a recent enough version

Oliver George10:05:55

No personal experience. The cljsjs project is a manual effort to package up JS deps so they are easy for clojurescript projects to use.

Jakob Durstberger10:05:09

Adding math-random and using it was super easy, so I think it actually is an issue with aws-amplify

Jakob Durstberger10:05:07

I had a look at aws-sdk-js and it seems like that is for talking to AWS services. I am new to the whole amplify thing but I think it is something slightly different.

Oliver George10:05:30

yeah, sorry. Bad google.

Oliver George10:05:11

I wonder if you had the right dep. If it's a re-frame app perhaps you need @aws-amplify/ui-react

Oliver George10:05:01

For what it's worth those libs didn't immediately work for me via the webpack tutorial.

Oliver George10:05:04

No I lied. They seem fine.

Oliver George10:05:14

I'll post a little repro in case it's helpful.

Oliver George10:05:07

My test was to print to console confirming I could see stuff in both libs

Jakob Durstberger10:05:18

Thank you, I’ll have a look at your repo

Jakob Durstberger11:05:00

I reverted all my changes and started from fresh and interestingly enough if I just add aws-amplify I can’t even compile the project because http2 is missing. When I add that dependency I am back to it compiling but not running, just frustrating 😕


@jakob.durstberger if you get an error about http2 missing then you need to bump your shadow-cljs version. that was fixed not too long ago.

Jakob Durstberger11:05:27

Interesting. I bumped the shadow-cljs version from 2.8.83 to 2.8.109. Now I just get

Syntax error (NoSuchFieldError) compiling at (shadow/cljs/devtools/api.clj:1:1).

Full report at:
Error encountered performing task 'do' with profile(s): 'dev'
Suppressed exit


thats a version conflict ...


make sure the shadow-cljs version matches the clojurescript version it expects ... or just use shadow-cljs.edn to manage deps which takes care of things like these ...


with .109 you should be using cljs 1.10.741


you likely have an old one specified in deps.edn or project.clj (whichever you are using)

Jakob Durstberger11:05:03

yeah, there is an older one in my project.clj. I’ll try updating that too

Jakob Durstberger11:05:18

Ok, I updated shadow-cljs and clojurescript. Now it isn’t complaining about http2 but process

Jakob Durstberger11:05:39

Is that expected?


do you have the shadow-cljs npm package installed in the project? so not just the global install?

Jakob Durstberger11:05:46

hmm yeah. I guess I should also update that one.


you used a template right? which one? seems like I need to take a look at that one.


version of that package isn't the issue here. it also bring in the node-libs-browser package which provides the process and other node built-in polyfills

Jakob Durstberger11:05:32

I ran lein new re-frame website +10x +cider +test +garden


thanks, I'll take a look at that one


picard-facepalm guess I'll need to have a word with the author

Jakob Durstberger11:05:20

Seems like it works now. I was able to import amplify and call (.configure Amplify config) Thank you so much @olivergeorge and @thheller for your help.

Oliver George11:05:36

👍 Thomas has your back. I didn’t realize you were using ShadowCLJS

Jakob Durstberger11:05:33

The whole clojurescript ecosystem + re-frame is new to me so I am not certain yet what is and isn’t important when I ask for help


How do I create a non-blocking suggestions input bar? So basically I'm taking in input and then making a get request using that input. But this blocks the input itself, which I don't want. So when typing the input hangs until the get request is made. Here's the code:

 (fn [db [_ suggestions]]
   (prn "updating suggestions to" suggestions)
   (assoc db :address-zip-suggestions suggestions)

(defn update-address-zip-suggestions [suggestions] (dispatch [:update-address-zip-suggestions suggestions]))

 (fn [db [_ zip]]

   ;; this seems to be blocking
     (let [response (<! (http/get (str (my-url) "/address-zip-suggestions")  {:query-params {:text (:user-address-zip db) :token "randomtoken"}}))
           suggestions (:body response)]

       (if (not (empty? suggestions))
         (update-address-zip-suggestions suggestions)
(defn user-address-suggestions [address-zip] (dispatch [:user-address-suggestions address-zip]))
 (fn [db [_ zip]]
   (user-address-suggestions zip)
   (assoc db :user-address-zip zip :address-zip-suggestions-shown? true)

(defn user-address-zip [user-address-zip] (dispatch [:user-address-zip user-address-zip]))

(defn address-zip-field []
  [:input (tw style/text-input {:placeholder "Enter Address or Zip Code"
                                #(user-address-zip (-> % .-target .-value))
How do I make it not block? So that the input doesn't hang or wait for the get request to finish?


What should I use for a new re-frame+leiningen+shadowjs project for adding npm dependencies? OR lein-cljsbuild OR lein-npm OR lein-shadow? This is rather confusing. Trying to follow various blog posts and it still fails to find a dependency: > The required JS dependency "@material-ui/core/Button" is not available, it was required by "foo/views.cljs".


i wouldn't use a template. i would just start a simple shadow-cljs project


the lein-shadow plugin lets you put the shadow-cljs stuff inside your project.clj file but all it does is just copy it right back out into a shadow-cljs.edn file. No real benefit from my eyes.


@nfedyashev with shadow-cljs it is just npm install the-package and use it. nothing else. unfortunately some tempaltes try to move that functionality into project.clj via lein plugins which I do not recommend


I've been trying to get a bootstrapped/self-hosted cljs repl in the browser with no server. I've found a few projects related to this: They both haven't seen commits in awhile, I'm curious if anyone knows if these type of approaches are still the way to go or if there have been any changes to cljs in the past few years that would make this easier or these approaches obsolete? On a more philosophical level, what is a repl exactly? Obviously read/eval/print. But it seems in clojure/script there's also the state related to namespaces which is separate from those steps. Also the ideas of an input/output stream. I'm having trouble building up intuition around this. I've started trying to read the related cljs source. Anyone happen to have any good reading material related to this?

Umar Daraz17:05:10

Hello clojurian, I m using shadow cljs in my journey to learn clojure/clojurescript. in development mode my server is running on port 3000 and shadow cljs server is at 8080. I m trying to proxy my api request to my server, here is what how i m trying to config proxy url. but it giving 404 error. Please help me with what im doing wrong?

:dev-http {8080 {
          :root "target/"
           :proxy-url ""}}


why are you using a proxy in the first place? why not just have your server on :3000 serve the output files? its just static files you need to serve, nothing else.

Umar Daraz09:05:01

thanks you so much of shadow cljs @thheller , I m pleasantly surprise to get the answer from the greater of shadow cljs it self. Honoured Just one confusion about that how the hot reloading will work, if I serve the output of shadow cljs from my api server? thanks again for the answer.


that is running over the default shadow-cljs server regardless. it connects over a websocket (normally running on :9630)


the :dev-http is really just a static file server nothing else


so you can just make your regular server serve the file. it does not affect hot-reload in any way

Umar Daraz16:05:23

Thanks @thheller I got it, will try it out.


@umardaraz4747 there's a dedicated #shadow-cljs channel for specific questions around shadow config, this is a more general channel

Umar Daraz04:05:42

Thanks @U050B88UR I m honoured to hear from you!


@jjttjj bootstrapped / self-host is a pretty advanced topic


if you have a lot of patience you could look at the ClojureScript source itself, those other projects depend on the fundamental support in ClojureScript so they're still relevant


the state stuff is compiler state, input/output stream are less relevant, bootstrapped ClojureScript works on strings


understood about it being advanced. I've had it "working" for a bit for my eval needs, just trying to take my understanding to the next level and was wondering if I was missing anything in my google searches 🙂


Will continue to keep reading the source though


Hi! Is there an apply analogue for javascript functions? I found js-invoke but that can't be called with a vector of args. Thanks!


apply should work with JS functions

Umar Daraz09:05:01

thanks you so much of shadow cljs @thheller , I m pleasantly surprise to get the answer from the greater of shadow cljs it self. Honoured Just one confusion about that how the hot reloading will work, if I serve the output of shadow cljs from my api server? thanks again for the answer.