Legacy Uploading Methods

Learn about how to upload source maps with older SDKs and Sentry tools.

This page describes how to upload source maps for older React Native SDKs. If you're using the latest version of the SDK, follow these instructions.

You need to generate and upload the source maps at build time for every release of your app for the events sent to be correctly unminified. To do so, follow these steps:

Configure the CLI by reviewing the configuration guide for CLI commands.

You can use the React Native CLI to generate the JavaScript bundle and source maps for your app:

Copied
react-native bundle \
  --dev false \
  --platform android \
  --entry-file index.android.js \
  --reset-cache \
  --bundle-output index.android.bundle \
  --sourcemap-output index.android.bundle.map

Learn more about the React Native CLI bundle command.

Pass your entry file to --entry-file for Android or iOS, respectively. By default, this file is usually named index.js. It is often named index.android.js for Android or index.ios.js for iOS.

These files will output your bundle and source maps. By default, these files are named index.android.bundle and index.android.bundle.map for Android and main.jsbundle and main.jsbundle.map for iOS.

The source map's name must be the bundle's name appended with .map for source maps to correctly be detected.

Copied
node_modules/@sentry/cli/bin/sentry-cli releases \
    files <release> \
    upload-sourcemaps \
    --dist <dist> \
    --strip-prefix /path/to/project/root \
    index.android.bundle index.android.bundle.map

If you're using sentry-cli prior to version 1.59.0, pass --rewrite to the upload-sourcemaps command to fix up the source maps before the upload (inlines sources and so forth). Version 1.59.0 does this automatically.

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