@@ -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 (
@@ -210,13 +212,13 @@ def setup_spotlight(options):
210212 if not isinstance (url , str ):
211213 return None
212214
213- if (
214- settings is not None
215- and settings . DEBUG
216- and env_to_bool ( os . environ . get ( "SENTRY_SPOTLIGHT_ON_ERROR" , "1" ))
217- and env_to_bool (os .environ .get ("SENTRY_SPOTLIGHT_MIDDLEWARE " , "1" ))
218- ):
219- with capture_internal_exceptions ( ):
215+ with capture_internal_exceptions ():
216+ if (
217+ settings is not None
218+ and settings . DEBUG
219+ and env_to_bool (os .environ .get ("SENTRY_SPOTLIGHT_ON_ERROR " , "1" ))
220+ and env_to_bool ( os . environ . get ( "SENTRY_SPOTLIGHT_MIDDLEWARE" , "1" ))
221+ ):
220222 middleware = settings .MIDDLEWARE
221223 if DJANGO_SPOTLIGHT_MIDDLEWARE_PATH not in middleware :
222224 settings .MIDDLEWARE = type (middleware )(
0 commit comments