bugsnag-js
bugsnag-js copied to clipboard
Support ReportingObserver reports
Here how Sentry plans ReportingObserver support https://github.com/getsentry/sentry/issues/9285, https://docs.sentry.io/platforms/javascript/#reportingobserver
Hi @laukstein
Thanks for the suggestion.
We've added support for ReportingObserver to our backlog which would allow reporting on deprecated APIs from browser JS.
This won't be an immediate priority, but we'll provide updates here when we decide to schedule this.
Any updates on this? cc: @xander-jones @johnkiely1
👋 @amhunt afraid not, this isn't something we've had a big calling for and so other priorities have taken its place. However, you could add a call to Bugsnag.notify() in the ReportingObserver callback as follows to get these reports to Bugsnag:
const observer = new ReportingObserver((reports, observer) => {
for (const report of reports) {
Bugsnag.notify(new Error(report.body.message), function (event) {
event.errors[0].errorClass = "ReportingObserver"
event.addMetadata("report", {
"type": report.type,
"url": report.url,
"body": report.body
})
})
}
});
observer.observe();

Worth noting that in this case the reporter's pointing to Bugsnag as the source of the error as I've got network breadcrumbs enabled so Bugsnag's wrapping the fetch() API, turning this off mean the ReportingObserver would then point to jQuery as the fault as I used $.ajax() to run test the deprecation, but in this case if you captured the network breadcrumbs you'd see what was happening at the time this report was fired.