Skip to content

fix(ios): Filter ExceptionsManager.reportException duplicates in app-start init#6144

Closed
alwx wants to merge 1 commit into
mainfrom
fix/duplicate-js-error-app-start-init
Closed

fix(ios): Filter ExceptionsManager.reportException duplicates in app-start init#6144
alwx wants to merge 1 commit into
mainfrom
fix/duplicate-js-error-app-start-init

Conversation

@alwx
Copy link
Copy Markdown
Contributor

@alwx alwx commented May 13, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Port the ExceptionsManager.reportException dedup filter into RNSentryStart.updateWithReactFinals so the file-based / early-native init path filters the same New Architecture C++ wrapper events as the JS-initiated path.

Background: there are two iOS beforeSend filter sites that both exist to drop JS errors the JS SDK already reported:

The C++ wrapper filter from #5532 was never ported into updateWithReactFinals, so users hitting the file-based init path on RN New Architecture see two events per JS error: the JS one and the C++ wrapper one captured by the native crash handler.

This PR adds the same ExceptionsManager.reportException value check in updateWithReactFinals so both init paths behave identically.

Android is unaffected: updateWithReactDefaults registers addIgnoredExceptionForType(JavascriptException.class) and is shared by both Android init paths.

💡 Motivation and Context

Fixes #6116. The previous fix for this class of duplicate (#5532, fix for #5529) only covered the JS-initiated init path. With v8's "Capture App Start Errors", the native SDK can be started before JS via sentry.options.json, which goes through a different filter site that didn't have the C++ wrapper check.

💚 How did you test it?

  • New Swift test testStartIgnoresJsErrorCppExceptionWrapper in RNSentryStartTests.swift exercises both RNSentrySDK.start(configureOptions:) and the dictionary-based RNSentryStart.start(options:) path (which is what sentry.options.json ends up calling). Verifies that:
    • an event with "ExceptionsManager.reportException" in its exception value is dropped, and
    • a legitimate C++ Exception (e.g. std::runtime_error) without that marker is kept.
  • Mirrors the existing JS-init coverage in RNSentryTests.m (testStartBeforeSendFiltersOutJSErrorCppException).
  • yarn lint:clang, yarn lint:swift, yarn lint:lerna clean.

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

…start init

When the native SDK is initialized early via sentry.options.json (the v8
"Capture App Start Errors" feature, #5582), unhandled JS errors on React
Native's New Architecture are wrapped in a C++ exception and captured by
the native crash handler. The deduplication added in #5532 / 7.9.0 lived
only in RNSentry.mm's prepareOptions (the JS-initiated init path), so the
RNSentryStart.updateWithReactFinals path used by the file-based and
`autoInitializeNativeSdk: false` flows let the C++ wrapper through and
users saw two events per JS error — one JS and one C++.

Port the `ExceptionsManager.reportException` value-based filter into
`updateWithReactFinals` so both init paths apply the same dedup. Mirror
the test coverage in RNSentryStartTests.swift, exercising both
`RNSentrySDK.start(configureOptions:)` and the dictionary-based
`RNSentryStart.start(options:)` (file-based) paths.

Android is unaffected: `updateWithReactDefaults` registers
`addIgnoredExceptionForType(JavascriptException.class)` which is shared
by both Android init paths.

Fixes #6116.
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(ios): Filter ExceptionsManager.reportException duplicates in app-start init by alwx in #6144
  • Multi-instance <TimeToInitialDisplay> / <TimeToFullDisplay> coordination; a multi-signal TTID/TTFD system by alwx in #6090
  • chore(deps): update Bundler Plugins to v5.3.0 by github-actions in #6138
  • chore: Merge 8.11.1 back to main by antonis in #6135
  • chore: Update warning regarding iOS crash in sentry-cocoa 9.12.0 by antonis in #6136
  • chore(deps): update CLI to v3.4.2 by github-actions in #6129
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.2 to 2.26.3 by dependabot in #6126
  • chore(deps): bump getsentry/craft from 2.26.2 to 2.26.3 by dependabot in #6127
  • chore(deps): bump github/codeql-action from 4.35.3 to 4.35.4 by dependabot in #6128
  • feat(core): Extract text from children of touched components for breadcrumb labels by antonis in #6106
  • chore(deps): bump @babel/plugin-transform-modules-systemjs from 7.25.0 to 7.29.4 by dependabot in #6124
  • chore(deps): bump fast-uri from 3.0.1 to 3.1.2 by dependabot in #6121
  • chore(deps): bump fast-xml-builder from 1.1.5 to 1.2.0 by dependabot in #6120
  • chore(deps): bump socks to ^2.8.8 to fix ip-address vulnerability by antonis in #6117
  • chore(deps): bump uuid to ^13.0.1 to fix buffer bounds check vulnerability by antonis in #6118
  • test(replay): Add passthrough tests for device-state replay breadcrumbs by antonis in #6115
  • chore(deps): update JavaScript SDK to v10.52.0 by github-actions in #6108
  • chore(deps): bump basic-ftp from 5.3.0 to 5.3.1 by dependabot in #6111

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Fixes

- Filter ExceptionsManager.reportException duplicates in app-start init ([#6144](https://github.com/getsentry/sentry-react-native/pull/6144))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against aa2a626

@alwx alwx self-assigned this May 13, 2026
@alwx alwx closed this May 13, 2026
@alwx alwx deleted the fix/duplicate-js-error-app-start-init branch May 13, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version 8.x.x with Capture App Start Errors enabled - duplicate JS issue reporting iOS Duplicate JS unhandled issues in new architecture

1 participant