Skip to content

[Due for payment 2026-11-23] [$175] [Sentry: APP-HWF / APP-N6Q / APP-M76] Web: CanvasKit load failures escape SkiaWebChart as unhandled rejections #105709

Open

Description

@mountiny

Sentry

Sentry ID Users (total since first seen) Events Users (last 14d, production 9.5.25 to 9.5.27) First seen Error
APP-HWF 50 796 6 (9.5.25: 1, 9.5.26: 4, 9.5.27: 1) 2026-07-16 ReferenceError: WebAssembly is not defined
APP-M76 84 177 4 (9.5.25: 4) 2026-09-21 RuntimeError: Aborted(both async and sync fetching of the wasm failed)
APP-N6Q 11 13 3 (9.5.26: 2, 9.5.27: 1) 2026-10-17 same error as APP-M76, different route

Impact (snapshot at filing)

  • Last seen: 2026-11-02 (ongoing, still on 9.5.27)
  • Platform: web (standalone), Chrome and Edge on Windows in the sample events
  • App version(s): 9.5.25 to 9.5.27 in the scan window
  • Affected route(s) (parameterized): /home, /search/view/:reportID
  • Mechanism: auto.browser.global_handlers.onunhandledrejection, level error, not app blocking

Stack trace (top frames, first-party only)

APP-HWF: ReferenceError: WebAssembly is not defined
  react lazyInitializer -> @shopify/react-native-skia/lib/module/web/WithSkiaWeb.js:15   await LoadSkiaWeb(opts)
  @shopify/react-native-skia/lib/module/web/LoadSkiaWeb.js:18                          CanvasKitInit(opts)
  canvaskit-wasm/bin/full/canvaskit.js:167                                             WebAssembly.instantiateStreaming

APP-M76 / APP-N6Q: RuntimeError: Aborted(both async and sync fetching of the wasm failed)
  @shopify/react-native-skia/lib/module/web/WithSkiaWeb.js:15                          await LoadSkiaWeb(opts)
  @shopify/react-native-skia/lib/module/web/LoadSkiaWeb.js:21                          CanvasKit = await ckSharedPromise
  canvaskit-wasm/bin/full/canvaskit.js:166                                             WebAssembly.instantiate -> abort

The only first-party caller of WithSkiaWeb is src/components/Charts/SkiaWebChart/index.tsx.

Suspected cause

SkiaWebChart wraps WithSkiaWeb in an ErrorBoundary, so the chart falls back to ChartFailedToLoad and the app keeps working. The CanvasKit init promise still rejects with no handler, so Sentry records an unhandled rejection. There are two gaps:

  1. isSkiaWebSupported (src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts) probes WebGL only. It does not check typeof WebAssembly, so browsers with WebAssembly turned off still mount Skia. Edge with enhanced security mode is a likely source of APP-HWF.
  2. When the canvaskit.wasm fetch fails (offline, or blocked by a proxy), the shared CanvasKit promise rejects and nothing catches it.

User impact is low: the chart shows its failed state. The fix should add a WebAssembly check to isSkiaWebSupported and catch the CanvasKit load rejection, so the fallback stays quiet.

Reproduction

  1. Open New Expensify in a browser with WebAssembly turned off, for example Edge with enhanced security mode set to strict.
  2. Open a page that renders a chart, such as /home.
  3. The chart shows its failed state, and Sentry records ReferenceError: WebAssembly is not defined.

These steps come from the stack trace and are not confirmed yet.

Related

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @truph01

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 3, 2026
  3. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External)

  4. changed the title [-][Sentry: APP-HWF / APP-N6Q / APP-M76] Web: CanvasKit load failures escape SkiaWebChart as unhandled rejections[/-] [+][$175] [Sentry: APP-HWF / APP-N6Q / APP-M76] Web: CanvasKit load failures escape SkiaWebChart as unhandled rejections[/+] on Nov 3, 2026
  5. melvin-bot commented on Nov 3, 2026

    @melvin-bot
  6. MelvinBot commented on Nov 3, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The unhandled rejection comes from inside canvaskit-wasm (0.41.0), not from App code. Our ErrorBoundary works, but it can't reach the promise that leaks.

    CanvasKitInit creates its own internal "ready" promise (ka in bin/full/canvaskit.js, line 8). When wasm setup fails, the glue rejects two promises:

    1. The promise CanvasKitInit returns. LoadSkiaWeb awaits it, and the ErrorBoundary catches it. Then logSkiaLoadError reports it as a warning.
    2. The internal ka promise. The glue returns it only on success, so after a failure nothing ever attaches a handler. The browser fires unhandledrejection, and Sentry records APP-HWF, APP-M76, or APP-N6Q.

    The two Sentry errors fail in different ways:

    • APP-HWF: WebAssembly is disabled. isSkiaWebSupported checks only WebGL, so Skia still mounts. The glue then reads WebAssembly.instantiateStreaming and throws a ReferenceError.
    • APP-M76 / APP-N6Q: WebAssembly exists, but the canvaskit.wasm fetch fails. The glue's abort() rejects ka and throws.

    LoadSkiaWeb resets ckSharedPromise after a failure. Each later chart mount starts a fresh CanvasKitInit and leaks another ka, so one user can send several events.

    What changes do you think we should make in order to solve the problem?

    1. Skip Skia when WebAssembly is missing. In isSkiaWebSupported, return unsupported when typeof WebAssembly !== 'object' or typeof WebAssembly.instantiate !== 'function'. CanvasKitInit never runs, so APP-HWF stops. Have the probe return a reason so ChartUnavailable can show the right text. The current WebGL message blames the wrong feature, and the "refresh" message won't help. Add a new key, for example common.webAssemblyNotSupported, in every locale.

    2. Drop only the leaked copy of a wasm fetch failure. Add a small noise-filter integration next to the others in THIRD_PARTY_NOISE_INTEGRATIONS. It should drop an event only when both of these are true:

      • The exception mechanism is onunhandledrejection.
      • The message matches Aborted(both async and sync fetching of the wasm failed) or WebAssembly is not defined, or the top frame is in canvaskit.js.

      The boundary's warning (fingerprint skia-web-chart-load-failure) still records every real failure. Don't use ignoreErrors. It matches on the message, so it would also drop that warning.

    3. Add unit tests for the probe (no WebAssembly, so unsupported) and for the filter (an unhandled copy is dropped and the boundary warning is kept).

    What alternative solutions did you explore? (Optional)

    • Patch canvaskit-wasm so it attaches a no-op .catch to ka. This fixes the leak at its source, but it means editing a minified vendor file again on every upgrade.
    • Add .catch to ckSharedPromise, or preload CanvasKit in a wrapper. Neither works. That promise is already handled, and ka is never exposed.
    Investigation details
    • In canvaskit-wasm@0.41.0/bin/full/canvaskit.js, line 8 has ka=new Promise((a,b)=>{fa=a;ia=b}). The createWasm catch at line 252 is catch(b){return ia(b),Promise.reject(b)}. moduleRtn=ka at line 257 runs only on success. The glue supports only the locateFile hook, with no instantiateWasm or onAbort, so App options can't intercept the failure.
    • APP-HWF frame canvaskit.js:167 is typeof WebAssembly.instantiateStreaming, which throws when the global doesn't exist. APP-M76 frame :166 is abort(), which calls ia(a); throw a.
    • SkiaWebChart is the only caller of WithSkiaWeb, so the probe change covers every chart.
    • Fix skia crash with mismatched canvaskit versions added the boundary and the handled path. It didn't introduce this leak, which comes from the vendor glue.
    • Not verified: I couldn't reach Sentry to confirm that each unhandled event has a matching skia-web-chart-load-failure warning in the same session. I also didn't confirm the exact mechanism.type string the web SDK sends. Check both before you finalize the filter.

    Possibly related: [HOLD FormidableLabs/victory-native-xl#687] Upgrade react-native-skia to v3. The upgrade changes the canvaskit-wasm version, so recheck the filter afterward.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105709) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  7. Hazem20wosis commented on Nov 3, 2026

    @Hazem20wosis

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On Web, when CanvasKit fails to load or instantiate (e.g. in environments where WebAssembly is disabled such as Edge in Enhanced Security Mode, or when fetching canvaskit.wasm fails due to network/proxy issues), unhandled promise rejections escape SkiaWebChart and flood Sentry with fatal errors (APP-HWF: ReferenceError: WebAssembly is not defined, APP-M76 / APP-N6Q: RuntimeError: Aborted(both async and sync fetching of the wasm failed)).

    What is the root cause of that problem?

    There are two distinct root causes:

    1. Missing WebAssembly Capability Probe in isSkiaWebSupported.ts:
      isSkiaWebSupported() (src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts) probes WebGL/WebGL2 context availability and shader precision format, but never checks whether WebAssembly is supported.
      In browsers where WebAssembly is disabled or blocked by security policies (e.g., Edge Enhanced Security Mode / Super Duper Secure Mode), isSkiaWebSupported() evaluates to true. SkiaWebChart proceeds to mount <WithSkiaWeb />, which calls LoadSkiaWeb() -> CanvasKitInit() -> WebAssembly.instantiateStreaming(), immediately throwing ReferenceError: WebAssembly is not defined (APP-HWF).

    2. Unhandled Promise Rejection from LoadSkiaWeb / CanvasKitInit:
      In @shopify/react-native-skia/lib/module/web/LoadSkiaWeb.js, CanvasKitInit(opts) returns a shared promise (ckSharedPromise).
      When canvaskit.wasm fails to download (e.g. offline, connection timeout, corporate proxy blocking wasm), canvaskit.js aborts and rejects this promise (APP-M76, APP-N6Q).
      Because <WithSkiaWeb /> lazily initializes CanvasKit inside an async import / component lifecycle without attaching a .catch() rejection handler on the shared module loader promise, the rejection is unhandled at the browser level and gets caught by window.onunhandledrejection, generating noisy Sentry error reports even though React's <ErrorBoundary> in SkiaWebChart gracefully shows ChartFailedToLoad.

    What changes do you think we should make in order to solve the problem?

    1. Add WebAssembly check to isSkiaWebSupported.ts:
      Guard isSkiaWebSupported() to verify that WebAssembly is globally defined and callable:

      --- a/src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts
      +++ b/src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts
      @@ -22,6 +22,11 @@ function getProbeContext(): WebGL2RenderingContext | WebGLRenderingContext | null {
       function isSkiaWebSupported(): boolean {
           try {
      +        // WebAssembly must be supported and enabled (e.g. Edge enhanced security mode disables it)
      +        if (typeof WebAssembly === 'undefined' || typeof WebAssembly.instantiate !== 'function') {
      +            return false;
      +        }
      +
               const gl = getProbeContext();
               // The context CanvasKit needs can't be created, so it would throw `failed to create webgl context`.
    2. Suppress unhandled rejections during CanvasKit loading in SkiaWebChart/index.tsx:
      In src/components/Charts/SkiaWebChart/index.tsx, attach an unhandledrejection event listener (or catch handler around the CanvasKit initialization lifecycle) scoped to CanvasKit / Skia wasm failures so they are routed through logSkiaLoadError as warnings without escaping as unhandled window rejections.

    What alternative solutions did you explore? (Optional)

    • Only catching errors in ErrorBoundary:
      Rejected because unhandled promise rejections originating from asynchronous CanvasKitInit script evaluation bypass standard React component ErrorBoundary lifecycles and trigger window.onunhandledrejection directly.

    What automated tests can you add to prevent this from re-occurring?

    In tests/unit/isSkiaWebSupportedTest.ts:

    • Add a unit test verifying isSkiaWebSupported() returns false when global.WebAssembly is undefined.
    • Verify isSkiaWebSupported() returns false when WebAssembly.instantiate is not a function.
    • Verify normal behavior when WebAssembly is present and WebGL context is available.

    Contributor Details

  8. ayolyn commented on Nov 3, 2026

    @ayolyn

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On Web, CanvasKit/Skia load failures escape as unhandled promise rejections, flooding Sentry with noise:

    • APP-HWF: ReferenceError: WebAssembly is not defined when WebAssembly is disabled (e.g. Edge Enhanced Security Mode).
    • APP-M76 / APP-N6Q: RuntimeError: Aborted(both async and sync fetching of the wasm failed) when canvaskit.wasm download fails (offline, connection timeout, proxy blocking wasm).

    Although SkiaWebChart wraps chart loading in an ErrorBoundary and logs the warning via logSkiaLoadError, the unhandled internal promise in canvaskit-wasm leaks to window.onunhandledrejection and generates spurious fatal Sentry issues.


    What is the root cause of that problem?

    1. Incomplete Capability Probe in isSkiaWebSupported.ts:
      isSkiaWebSupported.ts only probes WebGL2/WebGL context availability and shader float precision. It does not check for WebAssembly support. In environments where WebAssembly is disabled (such as Microsoft Edge in Strict Enhanced Security Mode), isSkiaWebSupported() returns true. SkiaWebChart mounts <WithSkiaWeb />, which calls LoadSkiaWeb() -> CanvasKitInit(), immediately throwing ReferenceError: WebAssembly is not defined (APP-HWF).

    2. Leaked Internal CanvasKit Promise Rejection on Wasm Fetch Failure:
      When canvaskit.wasm fails to download, canvaskit.js aborts and rejects its internal initialization promise. Because this internal promise has no catch handler attached at the script loader level, the rejection bubbles up to the browser's global unhandledrejection event (APP-M76 / APP-N6Q).
      Meanwhile, React's <ErrorBoundary> in SkiaWebChart catches the error and cleanly shows <ChartFailedToLoad />, while logSkiaLoadError logs a warning to Sentry under the skia-web-chart-load-failure fingerprint. The global unhandled rejection is therefore an unhandled duplicate that falsely escalates to fatal severity.


    What changes do you think we should make in order to solve the problem?

    1. Add WebAssembly check to src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts:

    At the start of isSkiaWebSupported(), verify WebAssembly is globally defined and provides instantiate:

    --- a/src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts
    +++ b/src/components/Charts/SkiaWebChart/isSkiaWebSupported.ts
    @@ -22,6 +22,11 @@ function getProbeContext(): WebGL2RenderingContext | WebGLRenderingContext | null {
     function isSkiaWebSupported(): boolean {
         try {
    +        // CanvasKit requires WebAssembly. If disabled (e.g. Edge enhanced security mode), skip Skia.
    +        if (typeof WebAssembly === 'undefined' || typeof WebAssembly.instantiate !== 'function') {
    +            return false;
    +        }
    +
             const gl = getProbeContext();
             // The context CanvasKit needs can't be created, so it would throw `failed to create webgl context`.

    When WebAssembly is disabled, isSkiaWebSupported() immediately returns false. SkiaWebChart displays <ChartUnavailable /> and never attempts to load CanvasKit, completely eliminating APP-HWF.

    2. Filter unhandled CanvasKit wasm rejections in src/setup/telemetry/setupSentry.ts:

    In src/setup/telemetry/setupSentry.ts (or in a dedicated noise filter integration in @libs/telemetry/integrations/), drop unhandled rejection events specifically originating from CanvasKit wasm aborts:

    const isCanvasKitWasmRejection = (event: Sentry.Event) => {
        const isUnhandledRejection = event.exception?.values?.[0]?.mechanism?.handled === false;
        const value = event.exception?.values?.[0]?.value ?? '';
        const isWasmAbort = value.includes('both async and sync fetching of the wasm failed') || value.includes('WebAssembly is not defined');
        return isUnhandledRejection && isWasmAbort;
    };
    • Real CanvasKit load failures continue to be reported as warnings via logSkiaLoadError with tag {context: 'skia-web-chart-load'} and fingerprint ['skia-web-chart-load-failure'].
    • The leaked, unhandled browser-level rejection is dropped, eliminating APP-M76 and APP-N6Q without masking legitimate chart rendering errors.

    What alternative solutions did you explore? (Optional)

    1. Adding ignoreErrors: [/both async and sync fetching of the wasm failed/] to Sentry.init:
      Rejected because ignoreErrors matches on the message across all reporting mechanisms, which would also suppress the intentional, structured logSkiaLoadError warning captured by the chart boundary. Filtering based on mechanism.handled === false drops only the leaked unhandled duplicate.
    2. Patching canvaskit-wasm vendor file:
      Rejected: Modifying third-party vendor bundles adds fragile patch maintenance overhead across updates when the capability probe and telemetry filter solve the issue at the application boundaries cleanly.

    What automated tests can you add to prevent this from re-occurring?

    1. In tests/unit/isSkiaWebSupportedTest.ts:
      • Test that isSkiaWebSupported() returns false when global.WebAssembly is undefined.
      • Test that isSkiaWebSupported() returns false when WebAssembly.instantiate is not a function.
      • Test that isSkiaWebSupported() returns true when WebAssembly and WebGL context are available.
    2. In tests/unit/setupSentryTest.ts:
      • Test that an unhandled rejection with both async and sync fetching of the wasm failed is filtered out.
      • Test that a handled warning from logSkiaLoadError is preserved and sent to Sentry.

    Contributor details

    Your Expensify account email: juliusayolyn@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c

  9. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  10. 7 remaining items

  11. TassioSales commented on Nov 8, 2026

    @TassioSales

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On web platforms where WebAssembly is disabled, blocked by CSP, or fails to initialize, CanvasKit fails to load, escaping SkiaWebChart as unhandled promise rejections (ReferenceError: WebAssembly is not defined / APP-HWF).

    What is the root cause of that problem?

    In SkiaWebChart/index.tsx (and the CanvasKit loader utility):
    CanvasKit initialization asynchronously loads the WebAssembly binary. When the browser environment lacks WebAssembly support or the fetch fails due to network/firewall policies, the promise rejection is not caught within the chart component boundary, leaking to the global window.onunhandledrejection handler and Sentry.

    What changes do you think we should make in order to solve the problem?

    1. In SkiaWebChart/index.tsx:
      • Add .catch() error handling to the CanvasKit initialization promise.
      • When CanvasKit fails to load, gracefully transition the chart state to a fallback mode: render a clean SVG chart or a lightweight placeholder component rather than throwing an unhandled exception.
      • Wrap the chart rendering tree in a dedicated React Error Boundary to isolate charting failures from the rest of the workspace/reports view.

    What alternative solutions did you explore? (Optional)

    Falling back to server-rendered chart images, but SVG client rendering provides instant local feedback without network latency.

  12. mountiny commented on Nov 8, 2026

    @mountiny
    ContributorAuthor

    (Vit's agent) @truph01 thanks for taking over the review here. These CanvasKit rejections are still active in Sentry. In the last 7 days, APP-HWF hit about 16 users, APP-M76 about 8, and APP-N6Q about 6. Could you review the proposals and pick one, so we can assign a contributor? If none of them is good enough, please share what is missing so we can keep this moving. Thank you!

  13. truph01 commented on Nov 10, 2026

    @truph01
    Contributor

    @MelvinBot Your proposal looks promising. Draft PR

    Screen.Recording.2026-11-10.at.10.42.28.mov
  14. MelvinBot commented on Nov 10, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ❌ fail

    Verification blocked: the existing web session rendered a blank page. No product behavior was verified.

    Blank page in the provided session

    Step Status
    /home charts and navigation with WebAssembly availableThe supplied session remained blank, with no navigation targets.
    Blank page in the provided session
    ❌
    WebAssembly-disabled fallbackNot tested: permitted tooling could not disable WebAssembly before initialization.
    ❌
    Blocked CanvasKit download fallbackNot tested: permitted tooling did not support network interception.
    ❌

    Created draft PR: Avoid CanvasKit initialization without WebAssembly and filter duplicate load errors, assigned to truph01.

    All 40 targeted tests, typecheck, lint, spelling, and Storybook smoke checks passed. Full-suite testing timed out; remaining verification limitations are documented in the draft.


    view run

  15. changed the title [-][$175] [Sentry: APP-HWF / APP-N6Q / APP-M76] Web: CanvasKit load failures escape SkiaWebChart as unhandled rejections[/-] [+][Due for payment 2026-11-23] [$175] [Sentry: APP-HWF / APP-N6Q / APP-M76] Web: CanvasKit load failures escape SkiaWebChart as unhandled rejections[/+] on Nov 16, 2026
  16. melvin-bot commented on Nov 16, 2026

    @melvin-bot

    @truph01

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.39-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-11-23. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions