Expo

Upload source maps for native Expo releases and EAS Update.

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.

To upload source maps, the Sentry Expo Plugin and the Sentry Metro Plugin need to be added to the Expo application.

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/",
          "note": "Use SENTRY_AUTH_TOKEN env to authenticate with Sentry.",
          "project": "example-project",
          "organization": "example-org"
        }
      ]
    ]
  }
}

Add auth token to your environment:

Copied
# DO NOT COMMIT YOUR AUTH TOKEN
export SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE

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;

When the Sentry Expo Plugin @sentry/react-native/expo and the Sentry Metro Plugin 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. Because symbolication is already handled by the Metro dev server, automatic uploading of source maps for debug builds is disabled.

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.

To create an update for the application use the following command:

Copied
# npx expo export --dump-sourcemap
eas update

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

  • dist is the default output directory of eas update.
  • Uploaded source maps have no associated releases. This is expected as updates can apply to multiple releases.

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").