Skip to content

_addTtfbRequestTimeToMeasurements throws TypeError: undefined is not an object (evaluating 't.responseStart') #11310

Closed
@ilmarivacklinsc

Description

@ilmarivacklinsc

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

Framework Version

17.0.2

Link to Sentry event

https://supercell.sentry.io/issues/5105529056/events/84972ab28bc94b619f11d795c70f2bfe/?project=4504167659208704

SDK Setup

Sentry.init({
    maxValueLength: 3000,
    environment: buildInfo.environmentName,
    release: buildInfo.buildId,
    integrations: [
        browserTracingIntegration(),
        reactRouterV6BrowserTracingIntegration({
            useEffect,
            useLocation,
            useNavigationType,
            createRoutesFromChildren,
            matchRoutes,
        }),
        extraErrorDataIntegration(),
    ],
    tracesSampleRate: 0.1,
    sampleRate: 0.1,
    ...opts,
});

(opts includes the DSN)

Steps to Reproduce

Just used the web page. Note that this is coming from an iOS WKWebView.

Expected Result

The type of getNavigationEntry says it can return undefined, but _addTtfbRequestTimeToMeasurements doesn't check for this. I think this line should be changed:

const navEntry = getNavigationEntry() as TTFBMetric['entries'][number];

Actual Result

No accessing undefined.

Metadata

Metadata

Assignees

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