Skip to content

Commit 81b8063

Browse files
BYKsentrivana
andauthored
fix(spotlight): Use the spotlight_url passed into the SDK when loading Spotlight (#3871)
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. --------- Co-authored-by: Ivana Kellyer <[email protected]>
1 parent 1239499 commit 81b8063

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sentry_sdk/spotlight.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def capture_envelope(self, envelope):
6666

6767
SPOTLIGHT_JS_ENTRY_PATH = "/assets/main.js"
6868
SPOTLIGHT_JS_SNIPPET_PATTERN = (
69-
'<script type="module" crossorigin src="{}"></script>'
69+
"<script>window.__spotlight = {{ initOptions: {{ sidecarUrl: '{spotlight_url}', fullPage: false }} }};</script>\n"
70+
'<script type="module" crossorigin src="{spotlight_js_url}"></script>\n'
7071
)
7172
SPOTLIGHT_ERROR_PAGE_SNIPPET = (
7273
'<html><base href="{spotlight_url}">\n'
@@ -113,7 +114,8 @@ def spotlight_script(self):
113114
)
114115
urllib.request.urlopen(req)
115116
self._spotlight_script = SPOTLIGHT_JS_SNIPPET_PATTERN.format(
116-
spotlight_js_url
117+
spotlight_url=self._spotlight_url,
118+
spotlight_js_url=spotlight_js_url,
117119
)
118120
except urllib.error.URLError as err:
119121
sentry_logger.debug(

0 commit comments

Comments
 (0)