Bundle.tracing.min.js cannot capture exceptions in CDN Lazy-Loading (Sentry.onLoad(()=> Sentry.init({}))) #7248
-
example code (Sentry cannot report javascipt exception logs) <script src="https://js.sentry-cdn.com/41d8b7c4a6724*******.loader.min.js" crossorigin="anonymous"></script>
<script>
throw new Error('error test1')
</script>
<script>
Sentry.onLoad(function() {
Sentry.init({
release: "[email protected]",
dsn: "https://41d8b7c4a6724*******@xxxxxxxxx/sentry/report/13",
integrations: [new Sentry.BrowserTracing()],
tracesSampleRate: 1.0
})
});
</script>
<script>
setTimeout(function () {
throw new Error('error test2')
},5000)
</script> I tracked the code and found the following problem.
1.1 first stepThe "addExtensionMethods" method is automatically executed after "tracing.bundle.min.js" downloaded. 1.2 second stepWhen the loader.min.js file code "_newScriptTag. addEventListener ('load ', ()=>{})" is executed, window.oneerror is reassigned.
1.3 third stepCall the Sentry.init method 1.4 but the window.onerror is null (by 1.2 step second) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @huanghairong2312 - currently the async loader is only supported for error monitoring bundles. Performance monitoring cannot be lazy loaded. Please stay tuned, we are working on addressing this! |
Beta Was this translation helpful? Give feedback.
-
Thanks @AbhiPrasad ! I am huanghairong2312's teammate. I deploy the lastest version(23.2.0) of sentry use docker-compose,According to sentry Using the Loader configuration , I get the following configuration: Open the above Lazy-Loading js and get the following error content:
To solve the above problem,I add the following configuration at (sentry/self-hosted-23.2.0/sentry/sentry.conf.py) according to Sentry JS lazily-loadable loader doesn't work
After that, lazy load js was opened successfully,It uses bundle.tracing.min.js: My question : as before, Lazy-Loading does not support performance monitoring. can i understand JS_SDK_LOADER_DEFAULT_SDK_The URL should be configured as bundle.min.js?
So Lazy-Loading js loads bundle.min.js. |
Beta Was this translation helpful? Give feedback.
Hey @huanghairong2312 - currently the async loader is only supported for error monitoring bundles. Performance monitoring cannot be lazy loaded. Please stay tuned, we are working on addressing this!