# Uncaught TypeError: Cannot read properties of undefined

**URL:** https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134
**Category:** Troubleshooting
**Tags:** re-frame, shadow-cljs
**Created:** [June 19, 2023, 3:41pm UTC](https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134 "2023-06-19T15:41:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![raoul2000](https://clojureverse.org/user_avatar/clojureverse.org/raoul2000/32/4719_2.png) [@raoul2000](https://clojureverse.org/u/raoul2000)
#### Post date: [June 19, 2023, 3:41pm UTC](https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134/1 "2023-06-19T15:41:09Z")

</div>

Hello,  
I have developed a small webapp based on re-frame and powered by shadow-cljs. It is working fine in dev mode (`shadow-cljs watch app`) with no error, no warning (except React complaining about ReactDOM.render not being supported anymore in React 18).

Then I build the release of the app (`shadow-cljs release app`) and in total confidence, access to the home page of my small webapp … but then boum ! blank page and this exception in the console :

![image](https://clojureverse.org/uploads/default/original/2X/6/63176bea637acc106151523b5f5ccbe54cc826cb.png)

Of course looking at the minified JS code in `main.js` didn’t help …

Has anyone ever exeprienced such behavior ? what would be your advice to investigate on this case ? How could I collect more info about what is happening that could cause thie exception ?  
Thanks for your help

---

<div class="post-metadata">

### Author: ![p-himik](https://clojureverse.org/user_avatar/clojureverse.org/p-himik/32/4137_2.png) [@p-himik](https://clojureverse.org/u/p-himik)
#### Post date: [June 19, 2023, 4:06pm UTC](https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134/2 "2023-06-19T16:06:32Z")

</div>

Most likely, something got minified when it wasn’t supposed to. E.g. if you have `(.-foo bar)` the compiler might decide that `foo` should be renamed. Usually in such cases the compiler is either quite certain about that or warns about not being able to infer the type of the target in the expression - in the latter case, you probably need to use `(.-foo ^js bar)`.

In any case, the first step would be to create a release build with pseudo names - you can do that by adding `--debug` to the shadow-cljs release build command.

---

<div class="post-metadata">

### Author: ![raoul2000](https://clojureverse.org/user_avatar/clojureverse.org/raoul2000/32/4719_2.png) [@raoul2000](https://clojureverse.org/u/raoul2000)
#### Post date: [June 19, 2023, 4:08pm UTC](https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134/3 "2023-06-19T16:08:28Z")

</div>

thanks @p-himik for your fast reply, I will follow your advice and keep on digging 😉

---

<div class="post-metadata">

### Author: ![raoul2000](https://clojureverse.org/user_avatar/clojureverse.org/raoul2000/32/4719_2.png) [@raoul2000](https://clojureverse.org/u/raoul2000)
#### Post date: [June 19, 2023, 4:34pm UTC](https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134/4 "2023-06-19T16:34:40Z")

</div>

Thanks to your help I could find the error ! Adding `--debug` allowed me to see the cljs code that was causing the error (something related to goog.events.KeyCodes).  
Now it works fine !!  
🥳

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [December 19, 2023, 4:34am UTC](https://clojureverse.org/t/uncaught-typeerror-cannot-read-properties-of-undefined/10134/5 "2023-12-19T04:34:41Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
