From 8d1ac1107efa03a347d0fb121e0af1e26e42375f Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Fri, 13 Dec 2024 10:35:51 +0000 Subject: [PATCH 1/3] fix(spotlight): Use the spotlight_url passed into the SDK when loading Spotlight When we inject spotlight, we don't set the correct sidecar URL. This is an issue when a user defines a custom sidecar URL where we are able to load Spotlight UI from the correct URL but don't tell it the correct sidecar URL, making it non-functional. --- sentry_sdk/spotlight.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/spotlight.py b/sentry_sdk/spotlight.py index a94c691723..c769d06dab 100644 --- a/sentry_sdk/spotlight.py +++ b/sentry_sdk/spotlight.py @@ -66,7 +66,8 @@ def capture_envelope(self, envelope): SPOTLIGHT_JS_ENTRY_PATH = "/assets/main.js" SPOTLIGHT_JS_SNIPPET_PATTERN = ( - '' + '\n' + '\n' ) SPOTLIGHT_ERROR_PAGE_SNIPPET = ( '\n' @@ -113,7 +114,7 @@ def spotlight_script(self): ) urllib.request.urlopen(req) self._spotlight_script = SPOTLIGHT_JS_SNIPPET_PATTERN.format( - spotlight_js_url + spotlight_url=self._spotlight_url, spotlight_js_url=spotlight_js_url ) except urllib.error.URLError as err: sentry_logger.debug( From 29b3ede792ef00513d94713e191a84821efe652c Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Fri, 13 Dec 2024 12:51:11 +0000 Subject: [PATCH 2/3] fix blunder Co-authored-by: Ivana Kellyer --- sentry_sdk/spotlight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/spotlight.py b/sentry_sdk/spotlight.py index c769d06dab..0c7aafd8f0 100644 --- a/sentry_sdk/spotlight.py +++ b/sentry_sdk/spotlight.py @@ -66,7 +66,7 @@ def capture_envelope(self, envelope): SPOTLIGHT_JS_ENTRY_PATH = "/assets/main.js" SPOTLIGHT_JS_SNIPPET_PATTERN = ( - '\n' + "\n" '\n' ) SPOTLIGHT_ERROR_PAGE_SNIPPET = ( From eb0f5e9ceb1d58f4f26aa41e1c5b7840dd0bcffd Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Fri, 13 Dec 2024 21:09:51 +0000 Subject: [PATCH 3/3] blacken --- sentry_sdk/spotlight.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/spotlight.py b/sentry_sdk/spotlight.py index 189744a11c..a783b155a1 100644 --- a/sentry_sdk/spotlight.py +++ b/sentry_sdk/spotlight.py @@ -114,7 +114,8 @@ def spotlight_script(self): ) urllib.request.urlopen(req) self._spotlight_script = SPOTLIGHT_JS_SNIPPET_PATTERN.format( - spotlight_url=self._spotlight_url, spotlight_js_url=spotlight_js_url + spotlight_url=self._spotlight_url, + spotlight_js_url=spotlight_js_url, ) except urllib.error.URLError as err: sentry_logger.debug(