Skip to content

Commit

Permalink
feat(core): Default filter unactionable error (#15527)
Browse files Browse the repository at this point in the history
We've been filtering a specific "undefined is not an object" error that
referenced "a.L" in our error filters. However, similar errors occured
with other uppercase letters (e.g. `a.K`) - they all represent the same
class of non-actionable error.

This pr just updates the filter to use a regex for this pattern.

ref getsentry/sentry#85531
  • Loading branch information
chargome authored Feb 27, 2025
1 parent 02e6d11 commit 4a7aa21
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/integrations/eventFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT_IGNORE_ERRORS = [
/^ResizeObserver loop completed with undelivered notifications.$/, // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.
/^Cannot redefine property: googletag$/, // This is thrown when google tag manager is used in combination with an ad blocker
/^Can't find variable: gmo$/, // Error from Google Search App https://issuetracker.google.com/issues/396043331
"undefined is not an object (evaluating 'a.L')", // Random error that happens but not actionable or noticeable to end-users.
/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/, // Random error that happens but not actionable or noticeable to end-users.
'can\'t redefine non-configurable property "solana"', // Probably a browser extension or custom browser (Brave) throwing this error
"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)", // Error thrown by GTM, seemingly not affecting end-users
"Can't find variable: _AutofillCallbackHandler", // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/
Expand Down
30 changes: 30 additions & 0 deletions packages/core/test/lib/integrations/eventFilters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ const TRANSACTION_EVENT_3: Event = {
type: 'transaction',
};

function createUndefinedIsNotAnObjectEvent(evaluatingStr: string): Event {
return {
exception: {
values: [{ type: 'TypeError', value: `undefined is not an object (evaluating '${evaluatingStr}')` }],
},
};
}

describe.each([
// eslint-disable-next-line deprecation/deprecation
['InboundFilters', inboundFiltersIntegration],
Expand Down Expand Up @@ -519,6 +527,28 @@ describe.each([
expect(eventProcessor(FB_MOBILE_BROWSER_EVENT, {})).toBe(null);
});

it("uses default filters (undefined is not an object (evaluating 'a.L'))", () => {
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
expect(eventProcessor(createUndefinedIsNotAnObjectEvent('a.L'), {})).toBe(null);
});

it("uses default filters (undefined is not an object (evaluating 'a.K'))", () => {
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
expect(eventProcessor(createUndefinedIsNotAnObjectEvent('a.K'), {})).toBe(null);
});

it("doesn't use default filters for (undefined is not an object (evaluating 'a.store'))", () => {
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
const event = createUndefinedIsNotAnObjectEvent('a.store');
expect(eventProcessor(event, {})).toBe(event);
});

it("doesn't use default filters for (undefined is not an object (evaluating 'this._perf.domInteractive'))", () => {
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
const event = createUndefinedIsNotAnObjectEvent('a.store');
expect(eventProcessor(event, {})).toBe(event);
});

it('filters on last exception when multiple present', () => {
const eventProcessor = createEventFiltersEventProcessor(integrationFn, {
ignoreErrors: ['incorrect type given for parameter `chewToy`'],
Expand Down

0 comments on commit 4a7aa21

Please sign in to comment.