Problem
When using native auto-init (useNativeInit: true / RNSentrySDK.start()), the sentry.options.json file is copied into the app bundle at build time. The build scripts already support overriding the environment field via the SENTRY_ENVIRONMENT env var, but there is no equivalent support for SENTRY_RELEASE or SENTRY_DIST.
This means users who set a custom release in JS Sentry.init() (e.g. ios-1.0.0-42 instead of the default com.app@1.0.0+42) end up with two releases in Sentry — one from the native init (auto-detected or from the options file) and one from JS init. Pre-JS crashes are attributed to the native release, while post-JS events go to the JS release.
There is no build-time mechanism to align the release/dist values in sentry.options.json with what JS will use, short of manually generating the file.
Related: #6064
Proposed Solution
Add SENTRY_RELEASE and SENTRY_DIST env var injection to both build scripts, following the existing SENTRY_ENVIRONMENT pattern:
iOS — scripts/sentry-xcode.sh
After the existing SENTRY_ENVIRONMENT block (lines 108-119), add equivalent blocks for SENTRY_RELEASE and SENTRY_DIST.
Android — sentry.gradle
After the existing SENTRY_ENVIRONMENT block (lines 48-59 in copySentryJsonConfiguration), add equivalent blocks for SENTRY_RELEASE and SENTRY_DIST.
Impact
Users with custom release formats can set SENTRY_RELEASE and SENTRY_DIST in their build environment (Xcode, EAS, CI) to keep native and JS releases aligned without manually generating sentry.options.json.
Problem
When using native auto-init (
useNativeInit: true/RNSentrySDK.start()), thesentry.options.jsonfile is copied into the app bundle at build time. The build scripts already support overriding theenvironmentfield via theSENTRY_ENVIRONMENTenv var, but there is no equivalent support forSENTRY_RELEASEorSENTRY_DIST.This means users who set a custom
releasein JSSentry.init()(e.g.ios-1.0.0-42instead of the defaultcom.app@1.0.0+42) end up with two releases in Sentry — one from the native init (auto-detected or from the options file) and one from JS init. Pre-JS crashes are attributed to the native release, while post-JS events go to the JS release.There is no build-time mechanism to align the release/dist values in
sentry.options.jsonwith what JS will use, short of manually generating the file.Related: #6064
Proposed Solution
Add
SENTRY_RELEASEandSENTRY_DISTenv var injection to both build scripts, following the existingSENTRY_ENVIRONMENTpattern:iOS —
scripts/sentry-xcode.shAfter the existing
SENTRY_ENVIRONMENTblock (lines 108-119), add equivalent blocks forSENTRY_RELEASEandSENTRY_DIST.Android —
sentry.gradleAfter the existing
SENTRY_ENVIRONMENTblock (lines 48-59 incopySentryJsonConfiguration), add equivalent blocks forSENTRY_RELEASEandSENTRY_DIST.Impact
Users with custom release formats can set
SENTRY_RELEASEandSENTRY_DISTin their build environment (Xcode, EAS, CI) to keep native and JS releases aligned without manually generatingsentry.options.json.