Repository navigation
fix(react-native-plugin): drop duplicate native captures of fatal JS errors and apply replay config at setup - #3824
Merged
Conversation
…eady reported by the JS layer
…hen replay starts disabled
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Reviews (1): Last reviewed commit: "chore(react-native-plugin): drop 2.0.0 d..." | Re-trigger Greptile |
6 tasks done
Contributor
Contributor
|
Size Change: 0 B Total Size: 16.8 MB ℹ️ View Unchanged
|
ioannisj
marked this pull request as ready for review
June 12, 2026 09:11
Contributor
|
Reviews (2): Last reviewed commit: "chore(react-native-plugin): drop 2.0.0 d..." | Re-trigger Greptile |
marandaneto
approved these changes
Jun 12, 2026
ioannisj
enabled auto-merge (squash)
June 12, 2026 09:20
1 of 12 tasks
5 tasks done
7 of 23 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes for
@posthog/react-native-plugin, both discovered during review of #3677 (which adds native crash capture toposthog-react-native). Releases together as2.0.1.1. Drop duplicate native captures of fatal JS errors
From #3677 (comment) (related: PostHog/posthog-android#567, PostHog/posthog-ios#653): with native crash autocapture enabled, a fatal JS error is captured twice — once by the JS layer (
uncaughtExceptionsautocapture) and once natively, because React Native rethrows fatal JS errors on the native side (AndroidJavascriptException, iOSRCTFatalException). We don't want to bill people twice per fatal error.The plugin now drops the native duplicate via the native SDKs'
beforeSendhooks:$exceptionevents whose$exception_listcontains aJavascriptExceptionfrom acom.facebook.react.*package.type/value(or signalcrash_info_message) containUnhandled JS Exception,ExceptionsManager.reportException, orfacebook::jsi::JSError.Verified end-to-end on release builds of
examples/example-expo-53against a local mock server:JavascriptExceptionJavascriptExceptionRCTFatalExceptionNSExceptionjsi::JSError→ genericSIGABRTKnown limitation (documented in code + changeset): on the iOS new architecture the fatal JS error surfaces as a generic
SIGABRTcrash event with no JS-error text in any field (posthog-ios' crash-info capture misses the libc++abi abort message), so the duplicate currently cannot be filtered there. Needs a posthog-ios fix — see PostHog/posthog-ios#653. The filter already checkscrash_info_message, so it activates as soon as posthog-ios surfaces the message.2. Apply session replay config at setup even when replay starts disabled
From #3677 (comment): when error tracking initializes the native SDK first (
sessionReplay.enabled: false), both native impls only appliedsdkReplayConfig(screenshot mode, masking, snapshot endpoint) inside theenabledguard. Replay toggled on later viastartRecording()then started with the wrong settings — wireframe mode instead of screenshot (broken for RN), default masking, default endpoint. Nativesetup()is ignored on second call, so the first config object is the one that sticks.setupNativeSdknow applies the replay configuration unconditionally and usesenabledonly to gate recording at launch. Verified against the pinned native SDKs that late-started replay honors setup-time config (Android installs the replay integration unconditionally; iOS lazily installs it instartSessionRecording), and end-to-end on the example app: error-tracking-only launch produces no snapshots; afterstartSessionRecording(), snapshots arrive in screenshot mode (control run without the fix reproduced the wireframe-mode bug). The legacystart(...)path is unchanged (enabledis always true there).