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

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:

Copied
{
  "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:

Copied
// 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:

Copied
# npx expo export
eas update

Upload Source Maps

To upload source maps for all platforms use the following command:

Copied
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 of eas update.

Notes

For a guide on how to manually upload source maps for Expo application releases, see the Expo (Advanced) source maps docs.

Help improve this content
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").