Skip to content

fix(browser): Guard against undefined nextHopProtocol #16806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 7, 2025

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Jul 3, 2025

fixes #16804

Although PerformanceResourceTiming.nextHopProtocol is available in all the browsers we support in v9, I think adding an extra guard is reasonable to make it easier for older browser support (it's hard to polyfill some of the performance apis).

This PR just adds a condition if (resourceTiming.nextHopProtocol != undefined).

Used cursor to generate some tests for the resourceTimingToSpanAttributes I extracted out.

@AbhiPrasad AbhiPrasad requested a review from a team July 3, 2025 16:47
@AbhiPrasad AbhiPrasad self-assigned this Jul 3, 2025
@AbhiPrasad AbhiPrasad requested review from stephanie-anderson and chargome and removed request for a team July 3, 2025 16:47
Copy link
Contributor

github-actions bot commented Jul 3, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.99 kB - -
@sentry/browser - with treeshaking flags 23.76 kB - -
@sentry/browser (incl. Tracing) 39.59 kB +0.02% +7 B 🔺
@sentry/browser (incl. Tracing, Replay) 77.78 kB +0.02% +8 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.86 kB +0.02% +12 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 82.5 kB +0.02% +10 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 94.66 kB +0.01% +9 B 🔺
@sentry/browser (incl. Feedback) 40.75 kB - -
@sentry/browser (incl. sendFeedback) 28.7 kB - -
@sentry/browser (incl. FeedbackAsync) 33.59 kB - -
@sentry/react 25.76 kB - -
@sentry/react (incl. Tracing) 41.59 kB +0.03% +9 B 🔺
@sentry/vue 28.37 kB - -
@sentry/vue (incl. Tracing) 41.37 kB +0.02% +8 B 🔺
@sentry/svelte 24.01 kB - -
CDN Bundle 25.5 kB - -
CDN Bundle (incl. Tracing) 39.61 kB +0.03% +10 B 🔺
CDN Bundle (incl. Tracing, Replay) 75.59 kB +0.02% +8 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 81.06 kB +0.02% +9 B 🔺
CDN Bundle - uncompressed 74.5 kB - -
CDN Bundle (incl. Tracing) - uncompressed 117.66 kB +0.03% +34 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 231.96 kB +0.02% +34 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 244.78 kB +0.02% +34 B 🔺
@sentry/nextjs (client) 43.23 kB +0.03% +12 B 🔺
@sentry/sveltekit (client) 40.05 kB +0.04% +13 B 🔺
@sentry/node 162.02 kB - -
@sentry/node - without tracing 98.64 kB - -
@sentry/aws-serverless 124.4 kB +0.01% +1 B 🔺

View base workflow run

cursor[bot]

This comment was marked as outdated.

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) July 7, 2025 15:23
cursor[bot]

This comment was marked as outdated.

@AbhiPrasad AbhiPrasad merged commit 85f9bd0 into develop Jul 7, 2025
129 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-nextHopProtocol-guard branch July 7, 2025 17:04
AbhiPrasad added a commit that referenced this pull request Jul 10, 2025
)

ref #16804

This was addressed with
#16806, but we didn't
guard every location that uses `entry.nextHopProtocol`.

Will backport to v9 after merge.

---------

Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PerformanceResourceTiming.nextHopProtocol is used without check for support
2 participants