Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Overview

Enable Expo Crash Reporting and Error Tracking to get comprehensive crash reports and error trends with Real User Monitoring.

With this feature, you can access the following features:

  • Aggregated Expo crash dashboards and attributes
  • Symbolicated iOS and deobfuscated Android crash reports
  • Trend analysis with Expo error tracking

In order to symbolicate your stack traces and deobfuscate Android crashes, upload your .dSYM, Proguard mapping files and source maps to Datadog using the expo-datadog config plugin.

Your crash reports appear in Error Tracking.

Setup

Use the expo-datadog package and configuration plugin. For more information, see the Expo and Expo Go documentation.

Add @datadog/datadog-ci as a development dependency. This package contains scripts to upload the source maps. You can install it with NPM:

npm install @datadog/datadog-ci --save-dev

or with Yarn:

yarn add -D @datadog/datadog-ci

Run eas secret:create to set DATADOG_API_KEY to your Datadog API key.

Setting the Datadog site

Run eas secret:create to set DATADOG_SITE to the host of your Datadog site, for example: datadoghq.eu. By default, datadoghq.com is used.

Plugin configuration options

ParameterDefaultDescription
iosDsymstrueEnables the uploading of dSYMS files for the symbolication of native iOS crashes.
iosSourcemapstrueEnables the uploading of JavaScript source maps on iOS builds.
androidSourcemapstrueEnables the uploading of JavaScript source maps on Android builds.
androidProguardMappingFilestrueEnables the uploading of Proguard mapping files to deobfuscate native Android crashes (is only applied if obfuscation is enabled).
datadogGradlePluginVersion"1.+"Version of dd-sdk-android-gradle-plugin used for uploading Proguard mapping files.

Get deobfuscated stack traces

Add git repository data to your mapping files on Expo Application Services (EAS)

If you are using EAS to build your Expo application, set cli.requireCommit to true in your eas.json file to add git repository data to your mapping files.

{
    "cli": {
        "requireCommit": true
    }
}

Limitations

Source maps, mapping files, and dSYM files are limited to 500 MB each.

Source maps, mapping files, and dSYM files are limited to 500 MB each.

Test your implementation

To verify your Expo Crash Reporting and Error Tracking configuration, you need to issue an error in your RUM application and confirm that the error appears in Datadog.

To test your implementation:

  1. Run your application on a simulator, emulator, or a real device. If you are running on iOS, ensure that the debugger is not attached. Otherwise, Xcode captures the crash before the Datadog SDK does.

  2. Execute some code containing an error or crash. For example:

    const throwError = () => {
     throw new Error("My Error")
    }
    
  3. For obfuscated error reports that do not result in a crash, you can verify symbolication and deobfuscation in Error Tracking.

  4. For crashes, after the crash happens, restart your application and wait for the React Native SDK to upload the crash report in Error Tracking.

To make sure your sourcemaps are correctly sent and linked to your application, you can also generate crashes with the [react-native-performance-limiter][14] package.

Install it with yarn or npm then re-install your pods:

yarn add react-native-performance-limiter # or npm install react-native-performance-limiter
(cd ios && pod install)

Crash the JavaScript thread from your app:

import { crashJavascriptThread } from 'react-native-performance-limiter';

const crashApp = () => {
    crashJavascriptThread('custom error message');
};

Re-build your application for release to send the new sourcemaps, trigger the crash and wait on the Error Tracking page for the error to appear.


## Additional configuration options

### Disable file uploads

You can disable some files from uploading by setting the `iosDsyms`, `iosSourcemaps`, `androidProguardMappingFiles`, or `androidSourcemaps` parameters to `false`.

```json
{
    "expo": {
        "plugins": [
            [
                "expo-datadog",
                {
                    "errorTracking": {
                        "iosDsyms": false
                    }
                }
            ]
        ]
    }
}

If you want to disable all file uploads, remove expo-datadog from the list of plugins.

Using Expo with Datadog and Sentry

Both Datadog and Sentry config plugins use regular expressions to modify the “Bundle React Native code and images” iOS build phase to send the sourcemap. This can make your EAS builds fail with a error: Found argument 'datadog-ci' which wasn't expected, or isn't valid in this context error.

To use both plugins, make sure to add the expo-datadog plugin first in order in your app.json file:

"plugins": [
    "expo-datadog",
    "sentry-expo"
]

If you are using the expo-dev-client and already have the expo-datadog plugin, revert its changes to the project.pbxproj file before adding sentry-expo and running npx expo prebuild with both plugins.

Further reading