Fork me on GitHub
#cljsrn
<
2021-01-29
>
frankitox00:01:28

Hi! Anyone using Sentry? I'm trying to set it up so I can get somewhat readable stacktraces. I'm using shadow-cljs, with compiler options :source-map, :pseudo-names and :pretty-print (based on what I read https://stackoverflow.com/questions/60543802/get-sourcemapped-source-place-in-browser). So, stacktraces look something like this:

new $cljs$core$PersistentArrayMap$$(null, 1, [$cljs$cst$keyword$style$$, new $cljs$core$PersistentArrayMap$$(null, 4, [$cljs$cst$keyword$f {snip}
  $cljs$cst$keyword$text$$, "Login with Facebook", $cljs$cst$keyword$enabled$$, $cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$($state$j {snip}
    return $re_frame$router$dispatch$$(new $cljs$core$PersistentVector$$(null, 1, 5, $cljs$core$PersistentVector$EMPTY_NODE$$, [$cljs$cst$ke {snip}
  }], null)], null), new $cljs$core$PersistentVector$$(null, 2, 5, $cljs$core$PersistentVector$EMPTY_NODE$$, [$myapp$components$login_but {snip}
  function() {
    throw Error("An error!");
Has anyone managed to do something better?

👀 3
thheller09:01:28

The problem is that react-native metro post processes the files after shadow-cljs is done with it and has generated the source maps. metro however doesn't take those source maps into account and generates its own rather useless ones. at least thats how it used to be the last time I looked at this. not sure this has changed.

👌 3
dotemacs09:01:37

Hi, I’m using Sentry in an app in production. I’m not seeing those issues at all. > How did I install it? Pretty vanilla. Added the dependency in package.json, then in cljs, required it like ["@sentry/react-native" :as sentry] and then initialised it with (sentry/init (clj->js my-config...)) where my-config is just a map of:

{:dsn "some-url-sentry-gives-you"
:debug true-or-false-depends-on-your-needs}
From that point on, you can just use it as: (sentry/captureException (str params)). So nothing here that should trip you up. Sentry works as expected. For :compiler-options in shadow-cljs.edn I have :optimizations :simple not those that you’re using.

thheller09:01:41

@dotemacs but do you get stacktraces for CLJS or just the compiled simple JS code?

dotemacs09:01:56

Checking now…

dotemacs09:01:32

So we don’t have that many stack traces, most of them are as expected, readable and not in the format as posted above by @franquito

thheller09:01:48

the above is using pseudo-named :advanced output. :simple will be much more readable but also quite a bit larger, although thats not super relevant for RN

👍 9
frankitox16:01:59

ahh, totally forgot about simple @dotemacs, thanks. btw, you see clojurescript code in your stack traces? this is what I'm getting with :simple

[myapp.components.header_title,"Login"],null)],null),new cljs.core.PersistentVector(null,5,5,cljs.core.PersistentVector.EMPTY_NODE,[re {snip}
null)],null),new cljs.core.PersistentVector(null,2,5,cljs.core.PersistentVector.EMPTY_NODE,[myapp.components.login_button,new cljs.core.P {snip}
1,5,cljs.core.PersistentVector.EMPTY_NODE,[cljs$cst$keyword$facebook_DASH_login_SLASH_start],null))}],null)],null),new cljs.core.PersistentV {snip}
cljs$cst$keyword$on_DASH_press,function(){throw Error("A :simple error");}],null)],null),new cljs.core.PersistentVector(null,2,5, {snip}
T

dotemacs16:01:12

Honestly @franquito I’m not seeing that, maybe because all our errors so far have been more on the native (as in ObjC or Swift) side

👍 3