Skip to content

Commit 18c27bc

Browse files
msonnbclaude
andauthored
fix(core): Match wrapped Facebook Mobile browser errors in DEFAULT_IGNORE_ERRORS (#23744)
## What Drops the `^` anchor on the Facebook Mobile browser pattern in `DEFAULT_IGNORE_ERRORS` and adds the sibling `Java object is gone` error. ## Why the Android WebView bridge wraps these errors as `Error invoking postMessage: Java exception was raised during method invocation`, so the start-anchored regex never matched. Only the end anchor is kept so the message still has to end with the known text and can't over-match unrelated errors. Fixes #23733 Co-authored-by: Claude Fable 5 <[email protected]>
1 parent 6327be6 commit 18c27bc

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎packages/core/src/integrations/eventFilters.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const DEFAULT_IGNORE_ERRORS = [
2020
/vv\(\)\.getRestrictions is not a function/, // Error thrown by GTM, seemingly not affecting end-users
2121
/Can't find variable: _AutofillCallbackHandler/, // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/
2222
/Object Not Found Matching Id:\d+, MethodName:simulateEvent/, // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps
23-
/^Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)
23+
/Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065, https://github.com/getsentry/sentry-javascript/issues/23733)
24+
/Java object is gone$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065, https://github.com/getsentry/sentry-javascript/issues/23733)
2425
];
2526

2627
/** Options for the EventFilters integration */

‎packages/core/test/lib/integrations/eventFilters.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,28 @@ const FB_MOBILE_BROWSER_EVENT: Event = {
373373
},
374374
};
375375

376+
const FB_MOBILE_BROWSER_POST_MESSAGE_EVENT: Event = {
377+
exception: {
378+
values: [
379+
{
380+
type: 'Error',
381+
value: 'Error invoking postMessage: Java exception was raised during method invocation',
382+
},
383+
],
384+
},
385+
};
386+
387+
const FB_MOBILE_BROWSER_JAVA_OBJECT_GONE_EVENT: Event = {
388+
exception: {
389+
values: [
390+
{
391+
type: 'Error',
392+
value: 'Error invoking postMessage: Java object is gone',
393+
},
394+
],
395+
},
396+
};
397+
376398
const MALFORMED_EVENT: Event = {
377399
exception: {
378400
values: [
@@ -497,6 +519,16 @@ describe('EventFilters', () => {
497519
expect(eventProcessor(FB_MOBILE_BROWSER_EVENT, {})).toBe(null);
498520
});
499521

522+
it('uses default filters (FB Mobile Browser, wrapped in postMessage error)', () => {
523+
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
524+
expect(eventProcessor(FB_MOBILE_BROWSER_POST_MESSAGE_EVENT, {})).toBe(null);
525+
});
526+
527+
it('uses default filters (FB Mobile Browser, Java object is gone)', () => {
528+
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
529+
expect(eventProcessor(FB_MOBILE_BROWSER_JAVA_OBJECT_GONE_EVENT, {})).toBe(null);
530+
});
531+
500532
it("uses default filters (undefined is not an object (evaluating 'a.L'))", () => {
501533
const eventProcessor = createEventFiltersEventProcessor(integrationFn);
502534
expect(eventProcessor(createUndefinedIsNotAnObjectEvent('a.L'), {})).toBe(null);

0 commit comments

Comments
 (0)