No way to tell when `Sentry.init()` is complete
See original GitHub issueReading the docs, and some of the code, I cant see a way to tell when Sentry.init()
is complete.
This is making it difficult to capture application errors that occur before Sentry is setup. From what I understand, Sentry will:
only monitor global errors and unhandled promise for you until the SDK is fully loaded
But, what if I want to wait until Sentry is loaded before I bootstrap my application? That way I can be confident that the errors are captured.
Right now, I’m loading Sentry after my app is ready. But app errors are ignored as Sentry isnt ready until after init
.
// ... my app init is before this
Sentry.init({
dsn: sentryDsn,
environment: environment,
debug: environment === 'local'
});
// these undefined errors are never captured
var a = b + c;
What I am wondering is how I can make sure Sentry “is done and ready” so that I can boot up my app and make sure app-level errors are captured?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Troubleshooting for JavaScript - Sentry Documentation
You can view the JSON payload of an event to see how Sentry stores additional data in the event. The shape of the...
Read more >Errors logged before Sentry.init() in the browser
We're loading the Sentry Browser SDK from the CDN and calling Sentry.init() to configure it. We would like for errors to not be...
Read more >Basic Options for JavaScript | Sentry Documentation
Options are passed to the init() function as object: ... Learn more about how to send release data so Sentry can tell you...
Read more >Tips and Tricks | Sentry Documentation
These are some general recommendations and tips for how to get the most out of Raven.js and Sentry. Decluttering Sentry The first thing...
Read more >JavaScript | Sentry Documentation
Head over to sentry.io , then return to this page. ... If you're updating your Sentry SDK to the latest version, check out...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@egor-sorokin can you take a look at our old plugin code and try to “port” it to your project? https://github.com/getsentry/sentry-javascript/blob/master/packages/raven-js/plugins/angular.js#L12-L49
It should be rather straightforward. We don’t document Angular 1.x anymore, as there are not many reports of people using it. We may need to do it though, if there are issues like the one mentioned above.
I recently faced the same problem: @sentry/browser: v 4.1.1 I have an angularjs app and I initialised Sentry before the main app (and I tried to initialise it in angular.run()), like so:
Then I put errors in controllers & factories but none of them was caught. After that I added a timeout with 0ms and it started work. Code snippet from angularjs controller:
@james2doyle example doesn’t work for me at all