Skip to content

Lots of TypeErrors using Sentry Replay integration #11388

@dd-jonas

Description

@dd-jonas

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.109.0

Framework Version

18.2.0

Link to Sentry event

https://creative-shelter.sentry.io/issues/5131060670/?project=6640281rer=issue-stream&statsPeriod=30d&stream_index=2

SDK Setup

Sentry.init({
  dsn: import.meta.env.PROD ? SENTRY_DSN : '',
  environment: import.meta.env.VITE_VERCEL_ENV,
  normalizeDepth: 10,
  integrations: [Sentry.replayIntegration({ maskAllText: false, networkDetailAllowUrls: [API_URL] }), Sentry.metrics.metricsAggregatorIntegration()],
  replaysSessionSampleRate: 1.0,
  replaysOnErrorSampleRate: 1.0,
});

The metrics integration has been recently added. This error has been occurring from before it was added.

Steps to Reproduce

  1. Init Sentry as shown above
  2. Observe the TypeError appearing in Sentry

Not sure what the specific trigger is

Expected Result

No such TypeErrors occurring

Actual Result

TypeError: Cannot read properties of undefined (reading 'replace')

This is an error that is triggered internally by Sentry Tracing, according to the stack trace. It happens in @sentry-internal/tracing/esm/browser/web-vitals/lib/initMetric.js on line 30:

if (navEntry) {
    if (WINDOW.document.prerendering || getActivationStart() > 0) {
      navigationType = 'prerender';
    } else {
      navigationType = navEntry.type.replace(/_/g, '-') ;
    }
  }

I'm not using the Tracing integration, but I notice the Replay integration calls some functionally of it (initMetric('LCP');).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: reactIssues related to the Sentry React SDK

    Projects

    Status

    No status

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions