Crash Reporting

This page covers the APIs specific for React-Native crash reporting.

We're covering crash reporting in this page. However, in the Reports Data section, you can find more information about the information and data sent with each bug report.

If your plan has crash reporting, crashes will automatically be reported and viewable from the Instabug dashboard.

Warning

While using the crash reporting feature the device shouldn't be connected to Xcode. When it is, Xcode catches all the exceptions and they are not sent to your dashboard.

Report Exception

To report exceptions manually, use the following method:

try {
      throw new SyntaxError();
    } catch (error) {
      alert(error.name);
      Instabug.reportJSException(error);
    }

Release Mode

Crashes will only be reported in release mode and not in debug mode.

iOS Crash Reporting

Native iOS Crashes

For iOS native crashes and details regarding symbolication and uploading dSYMs, please refer to the native iOS crash reporting documentation here.

JavaScript Crashes

Uploading iOS Source Map Files

You can follow these steps to generate iOS source-map files and upload them.
1 - Go to your root directory
2 - Run the following script:

react-native bundle --platform ios \
  --entry-file index.js \
  --dev false \
  --bundle-output ./ios/main.jsbundle \
  --sourcemap-output ./ios-sourcemap.json &&
  zip ./ios-sourcemap.zip ./ios-sourcemap.json

3 - Upload the generated file "ios-sourcemap.json", at your project’s root directory.

Android Crash Reporting

Native Android Crashes

For Android native crashes and details regarding deobfuscation and uploading mapping files, please refer to the documentation here.

JavaScript Crashes

Uploading Android Source Map Files

You can follow these steps to generate Android source-map files and upload them.
1 - Go to your root directory
2 - Run the following script:

react-native bundle --platform android \
  --entry-file index.js \
  --dev false \
  --bundle-output ./android/main.jsbundle \
  --sourcemap-output ./android-sourcemap.json &&
  zip ./android-sourcemap.zip ./android-sourcemap.json

3 - Upload the generated file "android-sourcemap.json", at your project’s root directory.

Uploading Files via API

Additionally, we have an API end point that you can use to upload your dSYMs, mapping files, and source map files directly from the console. The dSYMs must be uploaded as a zip file, the mapping file must be uploaded as a txt file, and the source map files must be uploaded as JSON files. Files should be uploaded one by one

URL:
/api/sdk/v3/symbols_files
METHOD:
POST
PARAMS:
file
platform=react_native&os=ios or platform=react_native&os=android
application_token

SDK Events

Before Sending a Report

This block is executed in the background before sending each report. It can be used for attaching logs and extra data to reports.

BugReporting.onReportSubmitHandler(function () {
    // Attach logs and extra data to reports.
});

Disabling and Enabling

Crash reporting can be disabled with the following method.

Instabug.setCrashReportingEnabled(false);