Ignored posthog-js and ember-concurrency cancellation errors in Sentry (#20383)

fixes https://linear.app/tryghost/issue/SLO-126
fixes https://linear.app/tryghost/issue/SLO-141
fixes https://linear.app/tryghost/issue/SLO-150

- during a session, posthog-js' rrweb extension can start throwing a lot
of errors. These errors do not affect the application
- similarly, ember-concurrency's task cancellation errors do not affect
the application. Task in ember-concurrency are expected to be canceled.
However, if they're cast to a Promise, they show up as unhandled Promise
rejections as Promises do not have a concept of cancellation
This commit is contained in:
Sag 2024-06-13 12:38:46 +02:00 committed by GitHub
parent ebda61ad42
commit 66f7911d24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -190,7 +190,12 @@ export default Route.extend(ShortcutsRoute, {
/^TransitionAborted$/,
// ResizeObserver loop errors occur often from extensions and
// embedded content, generally harmless and not useful to report
/^ResizeObserver loop completed with undelivered notifications/
/^ResizeObserver loop completed with undelivered notifications/,
/^ResizeObserver loop limit exceeded/,
// When tasks in ember-concurrency are canceled, they sometimes lead to unhandled Promise rejections
// This doesn't affect the application and is not useful to report
// - http://ember-concurrency.com/docs/cancelation
'TaskCancelation'
],
integrations: []
};

View File

@ -34,10 +34,17 @@ export function beforeSend(event, hint) {
delete event.tags.ajax_url;
}
// Do not report poshog-js errors to Sentry
if (hint && hint.originalException && hint.originalException.stack) {
if (hint.originalException.stack.includes('/posthog-js/')) {
return null;
}
}
return event;
} catch (error) {
// If any errors occur in beforeSend, send the original event to Sentry
// Better to have some information than no information
return event;
}
}
}