From 9e5ee4a6e8f099380b764f5db285ee77bc74aaa9 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht <> Date: Thu, 20 Oct 2022 13:39:05 -0700 Subject: [PATCH] bug: Prevent callign isInternal when not in the browser --- src/util/isInternal.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util/isInternal.ts b/src/util/isInternal.ts index de60a1a..65d47ed 100644 --- a/src/util/isInternal.ts +++ b/src/util/isInternal.ts @@ -1,7 +1,12 @@ +const isBrowser = typeof window !== 'undefined'; + /** * Returns true if we are currently recording an internal to Sentry replay * (e.g. on https://sentry.io ) */ export function isInternal() { - return ['sentry.io', 'dev.getsentry.net'].includes(window.location.host); + return ( + isBrowser && + ['sentry.io', 'dev.getsentry.net'].includes(window.location.host) + ); }