Skip to content

Commit 16ed613

Browse files
authored
feat: Ignore ResizeObserver and undefined error (#10845)
We want to filter out `ResizeObserver` error since they are not actionable and have no stacktrace and break transaction status. ref https://stackoverflow.com/a/77680580/1139707 Also, I added to filter out undefined errors - here are two events to Sentry to represent this. undefined: https://sentry.sentry.io/issues/3611187513/events/46ed8c398c234ff89baee87c5c341844/ ResizeObserver: https://sentry.sentry.io/issues/3611187513/events/48f25ea9dfbf4bd0b84a18982ee73362/
1 parent 3cb5108 commit 16ed613

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

packages/core/src/integrations/inboundfilters.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { convertIntegrationFnToClass, defineIntegration } from '../integration';
66

77
// "Script error." is hard coded into browsers for errors that it can't read.
88
// this is the result of a script being pulled in from an external domain and CORS.
9-
const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/];
9+
const DEFAULT_IGNORE_ERRORS = [
10+
/^Script error\.?$/,
11+
/^Javascript error: Script error\.? on line 0$/,
12+
/^ResizeObserver loop completed with undelivered notifications.$/,
13+
];
1014

1115
/** Options for the InboundFilters integration */
1216
export interface InboundFiltersOptions {

packages/core/test/lib/integrations/inboundfilters.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,17 @@ const SCRIPT_ERROR_EVENT: Event = {
188188
},
189189
};
190190

191+
const RESIZEOBSERVER_EVENT: Event = {
192+
exception: {
193+
values: [
194+
{
195+
type: 'Error',
196+
value: 'ResizeObserver loop completed with undelivered notifications.',
197+
},
198+
],
199+
},
200+
};
201+
191202
const MALFORMED_EVENT: Event = {
192203
exception: {
193204
values: [
@@ -294,6 +305,11 @@ describe('InboundFilters', () => {
294305
expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(null);
295306
});
296307

308+
it('uses default filters ResizeObserver', () => {
309+
const eventProcessor = createInboundFiltersEventProcessor();
310+
expect(eventProcessor(RESIZEOBSERVER_EVENT, {})).toBe(null);
311+
});
312+
297313
it('filters on last exception when multiple present', () => {
298314
const eventProcessor = createInboundFiltersEventProcessor({
299315
ignoreErrors: ['incorrect type given for parameter `chewToy`'],

0 commit comments

Comments
 (0)