Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crashlytics - Stacktrace in Firebase logs is not readable

I just started using React Native Firebase and Crashlytics (version 6). When I call firebase.crashlytics().recordError(error) in a JS catch block I see errors similar to the following in the Firebase Crashlytics logs. Is this the expected behavior?

This error log does not have any useful information, so I'm not sure if I'm using it correctly. (I thought about creating this as a bug report, but this seems like either the expected behavior or user error).

Errors triggered:

Firebase Crashlytics Logs

Stack trace from one of the errors:

Stack trace in Crashlytic log

If this is the expected behavior, I will probably call it like this: firebase.crashlytics().recordError(new Error('The error description');. That way I know where the error was, since I won't be able to tell from the line number where the error was. The downside of this is that it won't show the actual error message, so I'd know where the error was, but not what the error was.

Overall React-Native Firebase is working great for me, so thanks for all the hard work (if you're part of the team)!

like image 680
DowntownDev Avatar asked Oct 19 '19 00:10

DowntownDev


1 Answers

You can manually generate a sourcemap and then use a package such as source-map-cli to find the actual (non-minified) code causing the issue.

To generate a sourcemap run (modify filenames as necessary):

react-native bundle --platform ios --entry-file index.js --dev false --bundle-output ./ios/main.jsbundle --assets-dest ./ios --sourcemap-output ~/Desktop/bundle.js.map

Then to find line number of the actual code causing the issue, from Terminal run:

source-map resolve bundle.js.map 158093 26

The filename and line number will be outputted along with an excerpt of the code.

like image 65
Bataleon Avatar answered Nov 03 '22 02:11

Bataleon