Expo
Sentry's React Native SDK works out of the box with Expo applications. To see readable stack traces in the product, you must upload source maps to Sentry. This guide explains how to upload source maps for Expo applications.
Prerequisities
- Sign up for an account
- Migrate from
sentry-expo
to@sentry/react-native
- Set up Sentry React Native SDK version 5.16.0-alpha.4 or newer
Common Setup
To upload source maps, the Sentry Expo Plugin and the Sentry Metro Plugin need to be added to the Expo application.
Add the Sentry Expo Plugin
To ensure bundles and source maps are automatically uploaded during the local and EAS native applications builds, add the @sentry/react-native/expo
config plugin to the Expo application configuration:
{
"expo": {
"plugins": [
[
"@sentry/react-native/expo",
{
"url": "https://sentry.io/",
"warning": "DO NOT COMMIT YOUR AUTH TOKEN",
"authToken": "sntrys_YOUR_TOKEN_HERE",
"project": "example-project",
"organization": "example-org"
}
]
]
}
}
Add the Sentry Metro Plugin
To ensure unique Debug IDs are assigned to the generated bundles and source maps, add the Sentry Metro Plugin to the configuration:
// const { getDefaultConfig } = require("expo/metro-config");
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
// const config = getDefaultConfig(__dirname);
const config = getSentryExpoConfig(__dirname);
module.exports = config;
Automatic Upload for Release
When the Sentry Expo Plugin @sentry/react-native/expo
and the Sentry Metro Pugin are added to your application configuration, source maps for the native builds are uploaded automatically during EAS Builds and when building the native application release locally using npx expo prebuild
.
Manual Upload for EAS Updates
To upload source maps for EAS Updates and npx expo export
, set up the Sentry Expo Plugin, the Sentry Metro plugin and execute the sentry-expo-upload-sourcemaps
command.
Create Update
To create an update for the application use the following command:
# npx expo export
eas update
Upload Source Maps
To upload source maps for all platforms use the following command:
SENTRY_PROJECT=example-project \
SENTRY_ORG=example-org \
SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE \
npx sentry-expo-upload-sourcemaps dist
Notes
dist
is the default output directory ofeas update
.
Notes
For a guide on how to manually upload source maps for Expo application releases, see the Expo (Advanced) source maps docs.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
- Package:
- npm:@sentry/react-native
- Version:
- 5.18.0
- Repository:
- https://github.com/getsentry/sentry-react-native