Hello everyone,
I’m currently doing research on mobile frameworks. I was wondering if any of you are using crash tools for your app and how you are managing crashes. Currenty, I have a native app (Android), with crashlytics integrated. Most of the errors that occur, will result in app crashes. Crashlytics sends me diagnostic information about crashes. Because Ionic is running as a webview, I cannot integratie crashlytics into the webview (can we?) I also wonder if that would do any good, since I would get reports of the webview crashing.
Do angular/TS errors cause an Ionic app to crash, or does it just throw errors to the screen / console? And if so, is their a way we can collect those errors.
I looked into https://ionicframework.com/docs/native/app-center-crashes/ that’s looking good but also pretty basic.
TL;DR: How do you manage your crashes, any tips or tools?
For that purpose, I use and like sentry.io
@reedrichards I’ve been trying Ionic Pro Monitoring but never seem to get source-mapping working correctly. Does sentry.io work really well for you?
Thanks for the suggestion, I will look into that.
@richardshergold I’m really happy with sentry.io
The information they provide, even without uploading the map files, are really useful. Since I introduced it I really cleaned a couple of small issues I would have not find by myself (users behavior are sometimes surprising
)
Implementation was super easy
I don’t say it will help to solve every errors, sometimes you land on error you would have not know and maybe don’t know how to solve, like that https://forum.ionicframework.com/t/uncaught-in-promise-error-loading-chunk-20-failed, but that isn’t a problem of sentry, they just report well
Price model so far is ok, I’m far away of their billing limits
I could advice using their tool
1 Like
@reedrichards trying sentry today but not having much luck - is there anything missing in these docs to get the thing working with Ionic?
@richardshergold looking at the doc you pointed out I think I went a different way respectively the angular way not the cordova
so instead of sentry-cordova
I use raven-js
(npm install raven-js --save)
of course using the angular way means that you gonna report error when you debug while doing ionic serve
so think about implementing something to not report them
then also I skipped the source_map configuration, I don’t want to charge my bundle with source map “just” to have an easier way to track bug. Each time a update my app I keep on the side a copy of the apk or ipa, if I’m not able to track down the bug, I unzip these and have a look, but often I don’t need it, method names are often self explanatory
also I don’t do the init in app.module
I think it’s find to do it in the error handler
So, here’s my error handler (note it’s really useful to set version number and environment in the init):
import {IonicErrorHandler} from 'ionic-angular';
import Raven from 'raven-js';
Raven
.config(MY.SENTRY.DSN, {
release: MY.APP_VERSION,
environment: MY.ENVIRONMENT
})
.install();
export class SentryErrorHandler extends IonicErrorHandler {
handleError(err:any) : void {
super.handleError(err);
// here add a if if you don't want to track error locally while debugging
Raven.captureException(err);
}
}
and in app.module
section providers
{ provide: ErrorHandler, useClass: SentryErrorHandler}
1 Like
So you don’t use the sentry cordova plugin at all ?
Nope. I could confirms it works fine on iOS now that you are saying it I’m asking my self if it works on Android too (like google analytics javascript doesn’t work on Android Webview there you have to use the plugin)
UPDATE @richardshergold should be ok on Android too, saw some errors coming from Android devices too in my console (I double checked)
1 Like
@richardshergold don’t want to spam you, but just thought about it. It’s also a plus of course to use the angular version of Sentry because if you deploy your app as a pwa too, the reporting still gonna work without any code changes 
1 Like
Hey that’s not Spamming that’s helping! Thanks for the advice. Good point.
1 Like
@reedrichards got it working - early days but initial thoughts - it’s fantastic! Thanks for pointing me in that direction.
1 Like
@richardshergold awesome, cool to hear it worked out!
1 Like
@reedrichards I’m spamming you now (sorry). I’m having this issue on iOS - you ever had similar?
@reedrichards just remembered, you don’t use the plugin - you just use raven on it’s own. Maybe I should think about doing that if I can’t solve this issue.
@richardshergold exactly I don’t use the plugin, one of the only few plugin I was able to spare 
I will not be able to help for that special issue. spontaneously since it’s an error “plugin not found” I would suggest to double check that you access it when the platform.ready
and also maybe not in the app.component constructor
but later like in ngOnInit
or afterViewinit
but otherwise no idea, sorry
1 Like
thanks @reedrichards - I removed the plugin and have taken your route, all good now (well, so far anyway) 
1 Like
I hope now that you aren’t going to face problems 
Let me know if the results are good or if you need help!
2 Likes