Crashes not being reported on Crashlytics console
Expected Behavior
To show a Javascript crash on the Firebase Console.
Actual Behavior
Not showing a Javascript crash on the Firebase Console.
Steps to Reproduce the Problem
If I force a crash with Javascript, it doesn't show anything on the console. I'm putting the code on the beginning of my app. It crashes and it shows the crash on the local logs, but when I go to the Firebase Console, it not shows the crash.
This is what I write to force a crash:
var arr = [1,2,3,4];
var a = arr[5].test;
In my chrome console it shows:
Uncaught TypeError: Cannot read property 'test' of undefined
at init (app.js:1904)
at Channel.Initialize (app.js:2717)
at Channel.subscribe (cordova.js:772)
at document.addEventListener (cordova.js:129)
at HTMLDocument.document.addEventListener (cordova.js:1694)
at LoadDevice (app.js:1549)
at f (head.load.min.js:2)
at head.load.min.js:2
at head.load.min.js:2
at HTMLScriptElement.o (head.load.min.js:2)
And this message should appear to the Firebase Console, but it doesn't appear.
Specifications
- Plugin version: 2.0.5
- Framework: Cordova
- Framework version: 8.1.2 ([email protected])
- Operating system: MacOS High Sierra
I am having this same issue. Any work around or resolution?
Crashlytics only handles native crashes by default. You'll need to send javascript errors manually using FabricPlugin.logError, which is supposed to report them as non-fatal errors. I'm looking into this myself and from reading the source, it looks like on iOS this is broken and only sends them as logs instead of errors, but I could be mistaken.
You'll need to add a window error handler:
window.addEventListener('error', (e) => {
console.error(e);
if (window.FirebasePlugin) {
FirebasePlugin.logError('Window error handler hit: ' + e);
}
});
@distinctdan okay, I'm gonna try it, thanks.
There seems to be confusion on which pods to use and which plugins to use. Can we get some clarification. I got Firebase Crashlytics to work without this plugin, but when I use this plugin it never reports crashes. This plugin reports analytics, but no crashes or errors can be reported to the firebase console. Is there a sample app that has this working? @distinctdan
I'm pretty new here myself, but it looks like this repo is currently in transition as to maintainers. See this issue: https://github.com/arnesson/cordova-plugin-firebase/issues/1060
For myself, I'm looking into a fork by wizpanda which appears to be building correctly. I still need to try it out more though. I'll probably fork off of that one and fix the crash stuff in my own fork, then do a PR back here. https://github.com/wizpanda/cordova-plugin-firebase-lib
Alright, turns out iOS logging was indeed broken because it was calling the wrong method in CrashlyticsKit. I've fixed it for myself and have done a PR to the wizpanda repo here: https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/8
I am using the wizpanda plugin an doesnt work for me. I am using ionic and their wrap https://www.npmjs.com/package/@ionic-native/firebase.
When i use the method to send error to Crashlytics the promise always return the value 1, but not create the error in the console.
I tried to add my sha1 (I dont know if this is necesary) and doesnt work .
Any ligth on this?
@salime45 Are you iOS or Android? For iOS, it's only recording errors as logs, so you'll never see them currently. That's one of the fixes I did in my fork. One gotcha for iOS is xcode will eat your crash reports to prevent them from getting reported, so make sure your device isn't connected to your computer. Another gotcha for both platforms is it doesn't upload the crashes until you close and open your app again.
@salime45 Are you iOS or Android? For iOS, it's only recording errors as logs, so you'll never see them currently. That's one of the fixes I did in my fork. One gotcha for iOS is xcode will eat your crash reports to prevent them from getting reported, so make sure your device isn't connected to your computer. Another gotcha for both platforms is it doesn't upload the crashes until you close and open your app again.
I am working with Android. I try to send the error with the device not connected to PC and close and open the app again but doesnt work. Thanks
I dunno, it's impossible for me to know why it's not working without more information. Why don't you open android studio and set a breakpoint in the logError method and debug it to see what's going on? That would tell you if the android method is getting called. If it was erroring, you should see logs in logcat as well. If everything is getting called correctly, it's probably a config issue.
This are the logs, everything seems fine. 2019-06-14 10:23:58.630 22254-22254/com.isvisoft.ananke D/SystemWebChromeClient: http://localhost:8080/reservation-reservation-module.js: Line 283 : The logError2 is 1 2019-06-14 10:23:58.631 22254-22254/com.isvisoft.ananke I/chromium: [INFO:CONSOLE(283)] "The logError2 is 1", source: http://localhost:8080/reservation-reservation-module.js (283) 2019-06-14 10:23:58.812 812-812/? D/SurfaceFlinger: duplicate layer name: changing com.isvisoft.ananke/com.isvisoft.ananke.MainActivity to com.isvisoft.ananke/com.isvisoft.ananke.MainActivity#1
About configuration the analytics are registration well
i try to create a error in the java code and the error is not send to de firebase console. i dont know what happen
Hmm, not sure then, sorry.
@Gerarduu I have made my own Cordova firebase plugin and it works. I found that all other plugins are outdated and not being kept up with firebase. I am releasing an android version this week and documentation. https://www.npmjs.com/package/cordova-firebase-plugin and my GitHub repo https://github.com/cambronjay/cordova-firebase-plugin
@Gerarduu I have made my own Cordova firebase plugin and it works. I found that all other plugins are outdated and not being kept up with firebase. I am releasing an android version this week and documentation. https://www.npmjs.com/package/cordova-firebase-plugin and my GitHub repo https://github.com/cambronjay/cordova-firebase-plugin
My god, thank you very much. I'll try it when I'll get a chance. Thanks!
@Gerarduu The best version is the latest. I am about to put up some documentation for it.