However, if you use custom values for your release other than the version included with the build in Xcode or Android Studio, the automatic source maps upload script will no longer work because it does not detect custom values. As a result, you'll need to manually upload source maps using these steps:
For events sent from Sentry to correctly be attributed to a release and subsequently its source maps, both the
dist values will need to be set. You can set these values in the call to
init, as discussed in our Releases & Health content.
Before disabling the automatic source maps upload, you can set the
dist as environment variables,
SENTRY_DIST respectively. The script that performs the automatic source maps upload will use those values instead the default ones, and they will match the given
dist. This ensures that the given custom
dist values are used.
export SENTRY_RELEASE="firstname.lastname@example.org" export SENTRY_DIST="52"
If you've exported the environment variables and they match the given
dist during the
Sentry.init call, you can skip the next steps.
When you set a custom release or manually upload source maps, you will need to disable the automatic source map upload script:
In Android, remove the gradle integration.
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.
react-native bundle \ --dev false \ --platform android \ --entry-file index.android.js \ --bundle-output index.android.bundle \ --sourcemap-output index.android.bundle.map
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.map for Android 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.
node_modules/@sentry/cli/bin/sentry-cli releases \ files <release> \ upload-sourcemaps \ --dist <dist> \ --strip-prefix /path/to/project/root \ --rewrite 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.
If source maps are still not recognized, check for warnings similar to:
The bundle filename needs to match the filename on the event (and shown on the warning) to correctly apply the source maps.
Find more troubleshooting cases in our Troubleshooting documentation.