The Expo Datadog plugin (expo-datadog) is an Expo Config Plugin that automates the setup of crash reporting and error tracking for your Expo application. It ensures that all required debug artifacts—such as dSYMs, Proguard/R8 mapping files, and JavaScript sourcemaps—are automatically uploaded to Datadog during the build process.
To accomplish this, the plugin applies platform-specific build integrations:
iOS
- Adds an Xcode build phase to upload dSYMs using
datadog-ci dsyms upload - Modifies the "Bundle React Native code and images" build phase to upload sourcemaps using
datadog-ci react-native xcode
Android
- Adds the Datadog Gradle plugin (
com.datadoghq.dd-sdk-android-gradle-plugin) - Configures automatic Proguard/R8 mapping file uploads after minification
- Applies the
datadog-sourcemaps.gradlescript to upload JavaScript sourcemaps
Note: Make sure you've set up and initialized the Datadog React Native SDK before using this plugin.
Install the required peer dependencies:
npm install @datadog/mobile-react-native expo-datadogor with Yarn:
yarn add @datadog/mobile-react-native expo-datadogYou also need @datadog/datadog-ci for uploading symbols:
npm install --save-dev @datadog/datadog-ciAdd the plugin to your app.json or app.config.js:
{
"expo": {
"plugins": ["expo-datadog"]
}
}Create a datadog-ci.json file at the root of your project to configure the Datadog CI tool for uploading symbols and sourcemaps:
{
"apiKey": "<YOUR_DATADOG_API_KEY>",
"datadogSite": "datadoghq.com"
}| Property | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
required | Your Datadog API key |
datadogSite |
string |
"datadoghq.com" |
The Datadog site to upload symbols to |
| Site | URL |
|---|---|
| US1 | datadoghq.com |
| US3 | us3.datadoghq.com |
| US5 | us5.datadoghq.com |
| EU1 | datadoghq.eu |
| AP1 | ap1.datadoghq.com |
| AP2 | ap2.datadoghq.com |
| US1-FED | ddog-gov.com |
Alternatively, you can set these values as environment variables:
export DATADOG_API_KEY=<your-api-key>
export DATADOG_SITE=datadoghq.comAll configuration properties are optional. By default, all upload features are enabled.
| Property | Type | Default | Description |
|---|---|---|---|
iosDsyms |
boolean |
true |
Whether iOS dSYMs upload is enabled |
iosSourcemaps |
boolean |
true |
Whether iOS sourcemaps upload is enabled |
androidProguardMappingFiles |
boolean |
true |
Whether Android Proguard mapping files upload is enabled |
androidSourcemaps |
boolean |
true |
Whether Android sourcemaps upload is enabled |
serviceName |
string |
app bundle identifier | Service name used when uploading sourcemaps (both iOS and Android) |
datadogGradlePluginVersion |
string |
"1.14.0" |
Version of dd-sdk-android-gradle-plugin for Proguard mapping uploads |
| Variable | Description |
|---|---|
NODE_BINARY |
Path to Node.js binary, used in iOS build phases |
DATADOG_CI_EXEC |
Path to the datadog-ci executable (auto-detected if not set) |
DATADOG_API_KEY |
Your Datadog API key (can be set in datadog-ci.json instead) |
DATADOG_SITE |
Your Datadog site (can be set in datadog-ci.json instead) |
The plugin automatically configures Xcode build phases to upload dSYMs and sourcemaps. For the build phases to work correctly, ensure that:
- Your
.xcode.envor.xcode.env.localfile contains theNODE_BINARYpath:
# .xcode.env.local
export NODE_BINARY=$(command -v node)- Create a
datadog-ci.jsonfile at the root of your project (see Configure Datadog CI), or set your Datadog API key as an environment variable before building:
export DATADOG_API_KEY=<your-api-key>To upload native Android debug symbols (Proguard/R8 mapping files), you must enable minification in your release builds. Add the following to your android/gradle.properties:
android.enableMinifyInReleaseBuilds=trueWithout this setting, no mapping files are generated and the androidProguardMappingFiles option has no effect.
Create a datadog-ci.json file at the root of your project (see Configure Datadog CI), or set your Datadog API key in your android/gradle.properties or as an environment variable:
DATADOG_API_KEY=<your-api-key>{
"expo": {
"plugins": [
[
"expo-datadog",
{
"errorTracking": {
"iosDsyms": true,
"iosSourcemaps": true,
"androidProguardMappingFiles": true,
"androidSourcemaps": true,
"serviceName": "com.mycompany.myapp",
"datadogGradlePluginVersion": "1.22.0"
}
}
]
]
}
}After configuring the plugin, run expo prebuild to generate the native projects with Datadog configuration:
Important
These commands create proper release builds and trigger Datadog uploads, but they do not automatically upload your app to App Store Connect or Google Play.
# Generate native projects
npx expo prebuild
# Build for iOS
npx expo run:ios --configuration Release
# Build for iOS (alternative using xcodebuild)
cd ios && xcodebuild -workspace <YourApp>.xcworkspace -scheme <YourApp> -configuration Release -sdk iphoneos
# Build for Android
npx expo run:android --variant release
# Build for Android (alternative using Gradle directly)
cd android && DATADOG_API_KEY=<your-api-key> ./gradlew assembleReleaseNote for EAS Build: When using EAS Build, set your DATADOG_API_KEY as a secret in your EAS project settings:
eas secret:create --name DATADOG_API_KEY --value <your-api-key>When using NVM (Node Version Manager), the Xcode build phase may not find your Node installation. To fix this, create an ios/.xcode.env.local file (this file is gitignored by default):
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
export NODE_BINARY=$(command -v node)If you encounter the following error during Android builds:
> Task :app:uploadMappingRelease FAILED
error: No such remote 'origin'
This occurs because the Datadog Gradle plugin expects a git repository with a remote configured. To fix this, initialize a git repository and add a remote:
git init
git remote add origin <your-repository-url>If dSYM uploads fail, ensure that:
- Your
datadog-ci.jsonfile exists at the project root with valid credentials - The
DATADOG_API_KEYenvironment variable is set if not usingdatadog-ci.json - Your build is generating dSYMs (check Build Settings → Debug Information Format is set to "DWARF with dSYM File")
Ensure that:
- You have
@datadog/datadog-ciinstalled as a dev dependency - Your
datadog-ci.jsonfile or environment variables are correctly configured - You're building a release variant (sourcemaps are not uploaded for debug builds)
If you find an issue with this package and have a fix, please consult the Contributing Guidelines.