You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
On-error mobile replay orphaned when its error is dropped by sampleRate #6598
Since @sentry/core 10.70.0 (getsentry/sentry-javascript#22819), the error sampleRate roll runs afterbeforeSend. The mobile-replay on-error flush lives in a beforeSend wrapper (mobilereplay.ts), so it now uploads the buffered replay before the sampling decision. When the error is then dropped by sampleRate, the replay is uploaded with no corresponding error event.
sampleRate < 1.0 (error events are being sub-sampled)
A specific error that flushes the buffer and then loses the sampleRate roll
Full-session replays and default-sampleRate apps are not affected.
Proposed fix
JS: in beforeSend, only link the event to the buffered replay id (no upload); defer the native flush to the afterSendEvent client hook, which fires only for events that survive sampling and are actually sent. afterSendEvent already exists in core — no @sentry/core change needed.
Android: ✅ RN-repo-only. Read the buffered id from ReplayController.getReplayId() (public sentry-java API).
iOS: requires an upstream sentry-cocoa change. PrivateSentrySDKOnly.getReplayId reads the scope (empty while buffering) in all released versions incl. 9.27.0 / main; the buffered sessionReplayId is only reachable via internal APIs (getReplayIntegration, not in the public header). Fix: have getReplayId fall back to the integration's buffered sessionReplayId. iOS then follows with a cocoa bump.
changed the title [-]Investigate mobile replay capturing for error events dropped by sampleRate sampling[/-][+]On-error mobile replay orphaned when its error is dropped by `sampleRate`[/+]on Sep 7, 2026
Activity
linear-code commentedon Aug 21, 2026
RN-738
[-]Investigate mobile replay capturing for error events dropped by sampleRate sampling[/-][+]On-error mobile replay orphaned when its error is dropped by `sampleRate`[/+]fix(replay): Defer buffered replay upload until after error sampling (#…
github-actions commentedon Sep 10, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #6685, which was included in the 8.26.0 release.