Skip to content

fix(vue): Do not depend on window.location for SSR environments #7518

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 1 commit into from
Mar 20, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 20, 2023

When rendering in an SSR environment, window.location may not be defined. In this case, we should not error but just not start a transaction.

There may be more graceful ways to handle this, but IMHO this should be fine (and def. better than breaking in SSR).

Closes #7515

When rendering in an SSR environment, `window.location` may not be defined. In this case, we should not error but just not start a transaction.
@mydea mydea added Type: Bug Package: vue Issues related to the Sentry Vue SDK labels Mar 20, 2023
@mydea mydea requested a review from Lms24 March 20, 2023 08:44
@mydea mydea self-assigned this Mar 20, 2023
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.49 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 63.56 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.11 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 56.63 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 21.68 KB (0%)
@sentry/browser - Webpack (minified) 72.17 KB (0%)
@sentry/react - Webpack (gzipped + minified) 21.72 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 52.05 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 33.78 KB (0%)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.14 KB (0%)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 44.23 KB (+0.5% 🔺)
@sentry/replay - Webpack (gzipped + minified) 38.28 KB (+0.52% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 62.45 KB (+0.35% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 55.52 KB (+0.38% 🔺)

@mydea mydea merged commit c1e1db7 into develop Mar 20, 2023
@mydea mydea deleted the fn/vue-check-window branch March 20, 2023 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: vue Issues related to the Sentry Vue SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'pathname' of undefined
2 participants