---
title: "Expo (Advanced)"
description: "Manually upload source maps for native Expo releases."
url: https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced/
---

# Expo (Advanced) | Sentry for React Native

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 manually upload source maps for Expo application releases.

For a guide on how to automatically upload source maps for Expo application releases or updates, see the [Expo](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo.md) source maps docs.

## [Prerequisites](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#prerequisites)

* [Sign up for an account](https://sentry.io/signup/)
* [Migrate from `sentry-expo` to `@sentry/react-native`](https://docs.sentry.io/platforms/react-native/migration/sentry-expo.md)
* [Set up Sentry React Native SDK](https://docs.sentry.io/platforms/react-native/manual-setup/expo.md) version 5.16.0-alpha.4 or newer

## [Common Setup](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#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](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#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:

```javascript
{
  "expo": {
    "plugins": [
      [
        "@sentry/react-native/expo",
        {
          "url": "https://sentry.io/",
          "note": "Use SENTRY_AUTH_TOKEN env to authenticate with Sentry.",
          "project": "___PROJECT_SLUG___",
          "organization": "___ORG_SLUG___"
        }
      ]
    ]
  }
}
```

`npx expo install` adds the bare `@sentry/react-native` to the plugins array. Both `@sentry/react-native` and `@sentry/react-native/expo` are valid plugin paths. Expo resolves them the same way.

Add auth token to your environment:

```bash
# DO NOT COMMIT YOUR AUTH TOKEN
export SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
```

### [Add the Sentry Metro Plugin](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#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:

```javascript
// const { getDefaultConfig } = require("expo/metro-config");
const { getSentryExpoConfig } = require("@sentry/react-native/metro");

// const config = getDefaultConfig(__dirname);
const config = getSentryExpoConfig(__dirname);

module.exports = config;
```

## [Manual Upload for Hermes Release](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#manual-upload-for-hermes-release)

After the Sentry Expo Plugin and the Sentry Metro plugin are added to the application configuration, generate and upload Hermes source maps.

### [Generate Bundle](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#generate-bundle)

To generate a bundle and source maps for the native application release, use the following command:

```bash
# --entry-file node_modules/expo-router/entry.js \
npx expo export:embed \
  --entry-file node_modules/expo/AppEntry.js \
  --platform android \
  --dev false \
  --reset-cache \
  --bundle-output index.android.bundle \
  --sourcemap-output index.android.bundle.packager.map \
  --minify false
```

#### [Notes](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#notes)

* The actual command might differ depending on your application configuration. The above commands are the default commands used by Expo.
* Bundle and source maps names can change the generated debug ID.
* For custom entry file paths, the `--entry-file` parameter needs to be adjusted.

### [Compile Bytecode](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#compile-bytecode)

Compile Hermes bytecode bundle and source maps:

```bash
node_modules/react-native/sdks/hermesc/osx-bin/hermesc \
  -O -emit-binary \
  -output-source-map \
  -out=index.android.bundle.hbc \
  index.android.bundle
rm -f index.android.bundle
mv index.android.bundle.hbc index.android.bundle
```

Compose Hermes bytecode and (React Native Packager) Metro source maps:

```bash
node \
  node_modules/react-native/scripts/compose-source-maps.js \
  index.android.bundle.packager.map \
  index.android.bundle.hbc.map \
  -o index.android.bundle.map
node \
  node_modules/@sentry/react-native/scripts/copy-debugid.js \
  index.android.bundle.packager.map index.android.bundle.map
rm -f index.android.bundle.packager.map
```

### [Upload Source Maps](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#upload-source-maps)

Make sure `sentry-cli` is configured for your project and set up your environment variables:

`.env`

```bash
SENTRY_ORG=___ORG_SLUG___
SENTRY_PROJECT=___PROJECT_SLUG___
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
```

Upload the bundle and source maps to Sentry:

```bash
npx sentry-cli sourcemaps upload \
  --debug-id-reference \
  --strip-prefix /path/to/project/root \
  index.android.bundle index.android.bundle.map
```

## [Manual Upload for JSC Release](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#manual-upload-for-jsc-release)

After the Sentry Expo Plugin and Sentry Metro plugin are added to the application configuration, generate and upload JavaScript Core source maps.

### [Generate Bundle](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#generate-bundle-1)

To generate a bundle and source maps for the native application release, use the following command:

```bash
# --entry-file node_modules/expo-router/entry.js \
npx expo export:embed \
  --entry-file node_modules/expo/AppEntry.js \
  --platform android \
  --dev false \
  --reset-cache \
  --bundle-output index.android.bundle \
  --sourcemap-output index.android.bundle.map \
  --minify true
```

#### [Notes](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#notes-1)

* The actual command might differ depending on your application configuration. The above commands are the default commands used by Expo.
* Bundle and source maps names can change the generated debug ID.
* For custom entry file paths, the `--entry-file` parameter needs to be adjusted.

### [Upload Source Maps](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced.md#upload-source-maps-1)

Make sure `sentry-cli` is configured for your project and set up your environment variables:

`.env`

```bash
SENTRY_ORG=___ORG_SLUG___
SENTRY_PROJECT=___PROJECT_SLUG___
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
```

Upload the bundle and source map to Sentry:

```bash
npx sentry-cli sourcemaps upload \
  --strip-prefix /path/to/project/root \
  index.android.bundle index.android.bundle.map
```
