1

I have Firebase Crashlytics set up on a project and I know it's working (since it occasionally indeed shows some of the errors at the correct file).

I try crashlytics().recordError(err, 'api_error') (where err is a valid Error subclass object from axios) yet it is not seen on Crashlytics dashboard in Firebase console.

  • I am testing on a TestFlight build, not from Xcode/debugger/packager
  • I've waited and restarted the app several times (since I think they get uploaded afterwards)
  • I don't have any filters in issues list in Crashlytics dashboard.
  • I see a few of other warnings/non-fatal JS-side errors in issues, indicating Firebase SDK initialized correctly (otherwise I should not see anything).

Yet, it doesn't reflect to the dashboard. I've tried it several times. What am I doing wrong? (I'm on iOS 16.6)

UPDATE: I can perfectly force a crash with crashlytics().crash() and it shows in the dashboard immediately. There seems to be something to do with recordError. I've also changed crashlytics_debug_enabled to true in firebase.json yet no avail.

UPDATE 2:

When I dug further I've seen that recordError internally calls:

 StackTrace.fromError(error, { offline: true }).then(stackFrames => {
        this.native.recordError(createNativeErrorObj(error, stackFrames, false, jsErrorName));
});

And that fromError is defined as (in stacktrace library):

    fromError: function StackTrace$$fromError(error, opts) {
            opts = _merge(_options, opts);
            var gps = new StackTraceGPS(opts);
            return new Promise(function(resolve) {
                var stackframes = _filtered(ErrorStackParser.parse(error), opts.filter);
                resolve(Promise.all(stackframes.map(function(sf) {
                    return new Promise(function(resolve) {
                        function resolveOriginal() {
                            resolve(sf);
                        }

                        gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);
                    });
                })));
            }.bind(this));
        },

After stepping through breakpoints I've detected that the error stems from _filtered(ErrorStackParser.parse(error), opts.filter); line. ErrorStackParser. The parse method in there is (in error-stack-parser library):

  parse: function ErrorStackParser$$parse(error) {
            if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
                return this.parseOpera(error);
            } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
                return this.parseV8OrIE(error);
            } else if (error.stack) {
                return this.parseFFOrSafari(error);
            } else {
                throw new Error('Cannot parse given Error object');
            }
        },

My axios error comes correctly until the method above, but the code throws at throw new Error('Cannot parse given Error object');, throwing all the way upstream, therefore the error can never be submitted.

(also submitted as issue to the repo https://github.com/invertase/react-native-firebase/issues/7282)

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • Try getting debug logs, you will need to do this with Xcode but may give info about what the SDK is doing. 1) this is how you enable debug logging: https://firebase.google.com/docs/crashlytics/test-implementation?platform=ios 2) and the steps to get the logs: https://firebase.google.com/docs/crashlytics/test-implementation?platform=ios#force-test-crash – Gerardo Aug 02 '23 at 17:05
  • @Gerardo `-FIRDebugEnabled` was already in there (probably one of my colleagues previously put it there) yet I'm still not seeing my errors logged with `recordError` in dashboard. – Can Poyrazoğlu Aug 03 '23 at 14:22
  • Enabling debug log won't help seeing crashes in the dashboard. It instructs the SDK to provide verbose output in XCode. This can give us an idea if there is an issue or something blocking the Crashlytics SDK. Make sure you are following these steps to get these logs: https://firebase.google.com/docs/crashlytics/test-implementation?platform=ios#force-test-crash – Gerardo Aug 04 '23 at 00:08
  • @Gerardo yup I know it was just a follow-up. I've updated my question now: apparently `crash()` works perfectly so SDK is set up correctly. it's `recordError` which isn't working. – Can Poyrazoğlu Aug 04 '23 at 06:17

0 Answers0