Conversation
Sentry APP-8WS reports a TypeError naming top.webkit.messageHandlers.foregroundToBackground.postMessage. No code in the org calls webkit.messageHandlers, so the bridge is injected by an in-app browser and the error is not ours to act on. WebKit withholds the URL of an injected script, so denyUrls and thirdPartyErrorFilterIntegration cannot match it and ignoreErrors is the only filter that can. Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
🤖 Web test steps verification results: Exercised the full normal-usage flow (LHN/Inbox, open chat, send message, Settings navigation, back) on dev NewDot web with no visible errors, crashes, or failed network calls. However, the web test harness has no supported command to read the browser JS console directly, so the literal console-error assertion could only be inferred, not directly confirmed.
|
|
@MelvinBot can you also make sure this bug isn't related to the Mobile-Expensify repo? If so, please complete the checklist and mark all the checkboxes as done. For the QA steps, I think we should simply add: I'll add the test video to the reviewer checklist, so please mark that as done in the author checklist as well and open the PR for review. |







Explanation of Change
Adds one
ignoreErrorspattern tosetupSentryso Sentry drops theTypeError: undefined is not an object (evaluating 'top.webkit.messageHandlers.foregroundToBackground.postMessage')noise tracked as APP-8WS.This is not an App bug, so there is no App code to fix.
webkit.messageHandlersandforegroundToBackgroundappear zero times inExpensify/App,Expensify/Mobile-Expensify, or anywhere else in the org (verified by local grep oversrc,web,desktop,config,scripts, and by GitHub code search). The bridge is injected into the page by an in-app browser's WKWebView; the injected script then calls a handler that is no longer there. Nothing we ship can produce this error, and nothing we ship can prevent it.Why
ignoreErrorsis the filter that works. WebKit withholds the URL of an injected script, so the event arrives with no usable filename:denyUrlshas no scheme to match, andcreateReactNativeRewriteFramesrewrites what is left to a bareapp:///frame — exactly the shape documented for the_classCallChecknoise in [Sentry] Investigate and fixTypeError: Cannot call a class as a function. Matching on the exception message is therefore the only filter that can reach it. This mirrors the two existing third-party entries already in the same array.The pattern is
/webkit\.messageHandlers\./. It is intentionally keyed on the property path rather than one handler name, so sibling handlers injected by the same software (contextMenuMessageHandler,selectedDebugHandler, …) are covered by the same entry instead of needing a new pattern each time. The trailing dot keeps it to a real property access, so an unrelated error that merely names the bridge in prose still reports.Note on the platform label in the issue
The issue is labelled
MacOS: Chrome / Safari, but WebKit'sundefined is not an object (evaluating 'a.b.c')names the expression whose base was undefined. Here that base istop.webkit.messageHandlers.foregroundToBackground— meaningtop.webkit.messageHandlersdid exist. These sessions are inside a real WKWebView (an in-app browser, or iPadOS reporting as macOS), not plain desktop Safari. It does not change the fix, since the filter is platform-independent.Fixed Issues
$ #100268
PROPOSAL: #100268 (comment)
Tests
// TODO: The human co-author must fill out the tests they ran before marking this PR as "ready for review".
// Please describe what tests you performed that validate the change works.
AI Tests
Run locally by MelvinBot on the changed files (
src/setup/telemetry/setupSentry.ts,tests/unit/setupSentryTest.ts), per thetest-selection-matrixbundle forExpensify/AppTS changes:npm test -- --silenton all 6 telemetry/Sentry suitesnpm run lint-changednpm run typechecknpm run fmt(oxfmt)npm run spell-changedNot run, and left to CI:
npm testsuite (1483 test files) — exceeded this run's time budget. A partial run of the suite completed several hundred files with no failures before it was cut off.npm run storybook -- --smoke-test --ci— not run; this change touches no component or story.npm run react-compiler-compliance-check check-changed— not applicable; no.tsxand no components or hooks changed.Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
// TODO: The human co-author must fill out the QA steps before marking this PR as "ready for review".
// Note for whoever fills this in: this change only alters which events the Sentry client uploads. There is no
// user-visible behavior to exercise, and the filtering itself is verified by the unit tests above rather than
// by QA. Confirming the drop in production means watching APP-8WS stop receiving events after deploy.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari