Problem
We are currently on @sentry/react-native v7.6.0. Several issues motivate upgrading to v8:
- Android profiling crashes (#75036): Profiling on Android is disabled (
profilesSampleRate: 0) because it causes SIGABRT crashes in the hermes-sampling thread due to invalid pthread access. The Sentry team confirmed they are addressing these threading issues in newer SDK versions. Testing on v8 suggests the crash may be resolved.
- Native initialization support (#82974): v8 introduces first-class support for initializing Sentry from native code (via
RNSentrySDK.init() on Android and [RNSentrySDK start] on iOS) and a sentry.options.json config file. This enables capturing app start errors and crashes that occur before JS loads. PR #82858 already merged native Sentry initialization, and the v8 SDK provides cleaner APIs for this pattern.
- Updated native SDKs: v8 brings Cocoa SDK v9 (from v8.57.2), Sentry CLI v3 (from v2.58.0), and Android Gradle Plugin v6 (from v5.12.2), which include performance improvements, bug fixes, and better profiling stability.
- Maintenance burden of patches: We maintain 4 patches against
@sentry/core 10.24.0, @sentry/browser 10.24.0, and @sentry/react-native 7.6.0. These must be ported to the new versions. PR #84044 already includes these updated patches.
Solution
Upgrade @sentry/react-native from ^7.6.0 to 8.2.0 (or latest 8.x). This involves:
- Bump the dependency in
package.json from ^7.6.0 to 8.2.0
- Update native dependencies:
- iOS: Cocoa SDK
Sentry/HybridSDK 8.57.2 to Sentry 9.5.1, regenerate Podfile.lock
- Android:
io.sentry:sentry-android-gradle-plugin from 5.12.2 to 6.0.0 in Mobile-Expensify/Android/build.gradle
- Port existing patches to new package versions:
@sentry+core+10.24.0+001+data-sentry-label-support.patch → @sentry+core+10.39.0+...
@sentry+core+10.24.0+002+request-id-support.patch → @sentry+core+10.39.0+...
@sentry+browser+10.24.0+001+request-id-support.patch → @sentry+browser+10.39.0+... (note: v8 splits browser builds into dev/ and prod/ subdirectories, so the patch needs updating)
@sentry+react-native+7.6.0.patch → @sentry+react-native+8.2.0.patch
- Verify minimum platform requirements are met:
- iOS 15.0+ deployment target (previously 11.0+)
- Xcode 16.4+
- Kotlin 1.8+, Android Gradle Plugin 7.4.0+
- Re-test Android profiling to verify the
hermes-sampling SIGABRT crash is resolved; if so, re-enable profiling (profilesSampleRate > 0 on Android in setupSentry.ts)
- HybridApp compatibility: Verify no regressions in HybridApp builds (the PR was flagged for native code changes)
Breaking changes to verify (from migration guide)
- iOS minimum raised to 15.0+ (our current minimum should already meet this)
- Sentry CLI upgraded to v3 (impacts source map upload scripts in CI)
hoist-non-react-statics removed from @sentry/react (unlikely to affect us, but verify)
- Android Gradle Plugin 6.0.0 may require build.gradle adjustments
Related
Notes
- PR #84044 by @elirangoshen already implements the upgrade and is in review (requested by @roryabraham and @abdulrahuman5196)
- The
@sentry/webpack-plugin (v4.6.0, devDependency) does not need updating as part of this change
- Sentry CLI v3 has a different license (
FSL-1.1-MIT vs BSD-3-Clause) -- worth noting but should not block adoption
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
We are currently on
@sentry/react-nativev7.6.0. Several issues motivate upgrading to v8:profilesSampleRate: 0) because it causes SIGABRT crashes in thehermes-samplingthread due to invalid pthread access. The Sentry team confirmed they are addressing these threading issues in newer SDK versions. Testing on v8 suggests the crash may be resolved.RNSentrySDK.init()on Android and[RNSentrySDK start]on iOS) and asentry.options.jsonconfig file. This enables capturing app start errors and crashes that occur before JS loads. PR #82858 already merged native Sentry initialization, and the v8 SDK provides cleaner APIs for this pattern.@sentry/core10.24.0,@sentry/browser10.24.0, and@sentry/react-native7.6.0. These must be ported to the new versions. PR #84044 already includes these updated patches.Solution
Upgrade
@sentry/react-nativefrom^7.6.0to8.2.0(or latest 8.x). This involves:package.jsonfrom^7.6.0to8.2.0Sentry/HybridSDK 8.57.2toSentry 9.5.1, regeneratePodfile.lockio.sentry:sentry-android-gradle-pluginfrom5.12.2to6.0.0inMobile-Expensify/Android/build.gradle@sentry+core+10.24.0+001+data-sentry-label-support.patch→@sentry+core+10.39.0+...@sentry+core+10.24.0+002+request-id-support.patch→@sentry+core+10.39.0+...@sentry+browser+10.24.0+001+request-id-support.patch→@sentry+browser+10.39.0+...(note: v8 splits browser builds intodev/andprod/subdirectories, so the patch needs updating)@sentry+react-native+7.6.0.patch→@sentry+react-native+8.2.0.patchhermes-samplingSIGABRT crash is resolved; if so, re-enable profiling (profilesSampleRate> 0 on Android insetupSentry.ts)Breaking changes to verify (from migration guide)
hoist-non-react-staticsremoved from@sentry/react(unlikely to affect us, but verify)Related
Notes
@sentry/webpack-plugin(v4.6.0, devDependency) does not need updating as part of this changeFSL-1.1-MITvsBSD-3-Clause) -- worth noting but should not block adoptionIssue Owner
Current Issue Owner: @mallenexpensify