Skip to content

[Due for payment 2026-03-17] Upgrade @sentry/react-native from v7 to v8 #84200

@mountiny

Description

@mountiny

Problem

We are currently on @sentry/react-native v7.6.0. Several issues motivate upgrading to v8:

  1. 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.
  2. 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.
  3. 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.
  4. 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:

  1. Bump the dependency in package.json from ^7.6.0 to 8.2.0
  2. 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
  3. 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
  4. 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+
  5. 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)
  6. 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 OwnerCurrent Issue Owner: @mallenexpensify

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2ImprovementItem broken or needs improvement.Task

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions