Uploading Source Maps to Sentry | Stallion OTA Updates
Learn how to upload React Native source maps from Stallion OTA updates to Sentry for accurate error tracking. Step-by-step guide for Hermes and JavaScript Core builds, including source map composition and sentry-cli configuration. Integrate Stallion with Sentry for production stack trace resolution.
CLI Requirement:
Source map upload to Sentry requires Stallion CLI version 2.4.0 or above. Make sure you're running the latest version. Check the CLI Installation guide if you need to update.
Publish Bundle
When publishing with --keep-artifacts=true and --sourcemap=true, Stallion performs the standard OTA publish flow and additionally persists all bundle and sourcemap outputs on disk for Sentry integration.
Example command:
stallion publish-bundle --upload-path=orgname/project-name/bucket-name --platform=android/ios --release-note="notes" --keep-artifacts=true --sourcemap=true
This enables deterministic Sentry integration without re-running any React Native bundling step.
-
Normal OTA publish is executed
Stallion generates the platform bundles, applies Hermes compilation when enabled, uploads the OTA payload to the Stallion backend, and completes the rollout exactly as in a standard publish.
-
Source maps are generated
With
--sourcemap=true, Stallion ensures both standard JS sourcemaps and Hermes sourcemaps are produced for the publish.Instead of treating the bundle and sourcemap as temporary files, Stallion keeps the final outputs in a stable directory structure so you can reliably pick them up in CI and upload to Sentry.
-
Artifacts are persisted on disk
With
--keep-artifacts=true, Stallion does not delete any intermediate build outputs and writes the final bundle + sourcemap pairs into a stable, CI-friendly directory.The resulting structure is:
stallion-artifacts/ ├── android/ │ ├── normal/ │ │ ├── index.android.bundle │ │ └── index.android.bundle.map │ └── hermes/ │ ├── index.android.bundle │ └── index.android.bundle.hbc.map └── ios/ ├── normal/ | ├── main.jsbundle | └── main.jsbundle.map └── hermes/ ├── main.jsbundle └── main.jsbundle.hbc.map
Prepare sourcemaps for Sentry
Javascript Core
You can upload normal JS sourcemap directly to Sentry. No additional steps are required.
Hermes
Use the following commands to merge the packager + Hermes sourcemaps and preserve the Debug ID metadata (required by Sentry to correctly associate artifacts).
mv stallion-artifacts/android/normal/index.android.bundle.map stallion-artifacts/android/normal/index.android.bundle.packager.map
node \
node_modules/react-native/scripts/compose-source-maps.js \
stallion-artifacts/android/normal/index.android.bundle.packager.map \
stallion-artifacts/android/hermes/index.android.bundle.hbc.map \
-o stallion-artifacts/android/normal/index.android.bundle.map
node \
node_modules/@sentry/react-native/scripts/copy-debugid.js \
stallion-artifacts/android/normal/index.android.bundle.packager.map stallion-artifacts/android/normal/index.android.bundle.map
rm -f stallion-artifacts/android/normal/index.android.bundle.packager.map
Upload to Sentry
Make sure sentry-cli is configured for your project and set up your environment variables:
SENTRY_AUTH_TOKEN=your_sentry_auth_token
SENTRY_ORG=your_sentry_org
SENTRY_PROJECT=your_sentry_project
Upload the bundle and source map to Sentry:
Javascript Core
Upload source maps for React Native JavaScript Core application.
node_modules/@sentry/cli/bin/sentry-cli sourcemaps upload \
--debug-id-reference \
--strip-prefix /path/to/project/root \
stallion-artifacts/android/normal/index.android.bundle stallion-artifacts/android/normal/index.android.bundle.map
Hermes
Upload source maps for React Native Hermes applications.
node_modules/@sentry/cli/bin/sentry-cli sourcemaps upload \
--strip-prefix /path/to/project/root \
stallion-artifacts/android/hermes/index.android.bundle stallion-artifacts/android/normal/index.android.bundle.map
Wrap Your App
Ensure withStallion is the outermost function because it needs access to the root component in order to swap out the bundle.
export default withStallion(Sentry.wrap(App));
This ensures that both Stallion and Sentry are properly configured to work together, with Stallion handling OTA updates and Sentry handling error tracking.