Skip to content

No replays captured for errors events at a 1.0 rate #11262

Closed
@zkhishy

Description

@zkhishy

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

7.107.0

Framework Version

18.2

Link to Sentry event

No response

SDK Setup

import * as Sentry from '@sentry/react';
const {
  REACT_APP_SENTRY_DSN,
  REACT_APP_SENTRY_TRACE_SAMPLE_RATE = 1.0,
  REACT_APP_SENTRY_REPLAY_SESSIONS_SAMPLE_RATE = 0.1,
  REACT_APP_SENTRY_REPLAY_ON_ERROR_SAMPLE_RATE = 1.0,
  REACT_APP_SENTRY_ENVIRONMENT = 'production',
} = import.meta.env;

console.log("REPLAY_SESSIONS_SAMPLE_RATE", REACT_APP_SENTRY_REPLAY_SESSIONS_SAMPLE_RATE) // 0.1
console.log("REPLAY_ON_ERROR_SAMPLE_RATE", REACT_APP_SENTRY_REPLAY_ON_ERROR_SAMPLE_RATE) // 1.0

Sentry.init({
  debug: true,
  replaysSessionSampleRate: REACT_APP_SENTRY_REPLAY_SESSIONS_SAMPLE_RATE,
  replaysOnErrorSampleRate: REACT_APP_SENTRY_REPLAY_ON_ERROR_SAMPLE_RATE,
  dsn: REACT_APP_SENTRY_DSN,
  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.replayIntegration(),
  ],
  environment: REACT_APP_SENTRY_ENVIRONMENT,
  tracesSampleRate: REACT_APP_SENTRY_TRACE_SAMPLE_RATE, // 1.0
});

Steps to Reproduce

To reproduce, just start the app and throw errors

I'm throwing errors in various ways in the app (multiple of them to try and get around a log message from the sentry client saying it won't report an already captured exception, not sure I understood it correctly, but just in case), I'm also using

<button
  type="button"
  onClick={() => {
    throw new Error("Sentry Test Error");
  }}
>
  Break the world
</button>

from https://docs.sentry.io/platforms/javascript/guides/react/session-replay/

but none of the reported errors (both manually synthesized or real errors) on the app (sentry.io/issues) have replays associated with them.

This line is always present in the output

Sentry Logger [log]: Integration installed: Replay

These lines (tagged with [Replay]) are only present when I manually call replay.start() or if I set the replaysSessionSampleRate to 1.0

Sentry Logger [info]: [Replay] Starting replay in session mode
Sentry Logger [info]: [Replay] Loading existing session
Sentry Logger [info]: [Replay] Using compression worker
...
Sentry Logger [info]: [Replay] Pausing replay
Sentry Logger [info]: [Replay] Document has become active, but session has expired
Sentry Logger [info]: [Replay] Document has become active, but session has expired

Expected Result

Errors are always sampled when I set the rate to 1.0 on errors

Actual Result

No automatic error sampling

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: reactIssues related to the Sentry React SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions