Bug description
When Firebase AppCheck's JS SDK performs automatic background token refresh and the network is unavailable, it throws an unhandled promise rejection. In a Flutter web app, this surfaces as a JSObject: FirebaseError that reaches runZonedGuarded as a fatal unhandled error. The Dart firebase_app_check wrapper has no mechanism to intercept or suppress this.
Error
JSObject: FirebaseError: AppCheck: Fetch failed to connect to a network.
Check Internet connection. Original error: Load failed. (appCheck/fetch-network-error).
Context
Chrome Mobile iOS, app backgrounded, single transient network blip. Firebase recovers automatically on retry, so the error is purely noise — but it's reported as fatal by the Dart runtime.
Steps to reproduce
- Initialize Firebase AppCheck with
activate(webProvider: ReCaptchaV3Provider(...)) in a Flutter web app
- Lose network connectivity (e.g., toggle airplane mode, or the browser suspends network when the app is backgrounded on mobile)
- Wait for the AppCheck SDK's automatic background token refresh to fire
- Observe unhandled
JSObject: FirebaseError reaching runZonedGuarded
Expected behavior
Background token refresh network failures should be handled internally by the SDK (retry silently) without throwing unhandled promise rejections into the host app's zone.
Possible fix
The firebase_app_check_web platform implementation could zone-guard the JS interop bridge to catch transient errors from the JS SDK's internal timer-based refresh, or surface them through a dedicated error stream/callback rather than letting them propagate as unhandled exceptions.
Workaround
Filter FirebaseError events containing fetch-network-error in Sentry's beforeSend hook (or equivalent error reporting filter).
Flutter doctor
Flutter 3.41.4 • Dart 3.11.1
Platform
Web (Chrome Mobile iOS 145.0.7632)
Bug description
When Firebase AppCheck's JS SDK performs automatic background token refresh and the network is unavailable, it throws an unhandled promise rejection. In a Flutter web app, this surfaces as a
JSObject: FirebaseErrorthat reachesrunZonedGuardedas a fatal unhandled error. The Dartfirebase_app_checkwrapper has no mechanism to intercept or suppress this.Error
Context
Chrome Mobile iOS, app backgrounded, single transient network blip. Firebase recovers automatically on retry, so the error is purely noise — but it's reported as fatal by the Dart runtime.
Steps to reproduce
activate(webProvider: ReCaptchaV3Provider(...))in a Flutter web appJSObject: FirebaseErrorreachingrunZonedGuardedExpected behavior
Background token refresh network failures should be handled internally by the SDK (retry silently) without throwing unhandled promise rejections into the host app's zone.
Possible fix
The
firebase_app_check_webplatform implementation could zone-guard the JS interop bridge to catch transient errors from the JS SDK's internal timer-based refresh, or surface them through a dedicated error stream/callback rather than letting them propagate as unhandled exceptions.Workaround
Filter
FirebaseErrorevents containingfetch-network-errorin Sentry'sbeforeSendhook (or equivalent error reporting filter).Flutter doctor
Platform
Web (Chrome Mobile iOS 145.0.7632)