[firebase_remote_config]: onConfigUpdated emits errors when window is hidden or minimized
Is there an existing issue for this?
- [x] I have searched the existing issues.
Which plugins are affected?
Remote Config
Which platforms are affected?
Web
Description
On Flutter Web using onConfigUpdated, following error is emitted when the browser is minimized or when switching macOS Spaces:
FirebaseError: Remote Config: The stream was not able to connect to the backend: Unable to connect to the server. HTTP status code: undefined. (remoteconfig/stream-error)
Reproducing the issue
- use onConfigUpdated
FirebaseRemoteConfig.instance.onConfigUpdated.listen(
(event) async {
await remoteConfig.activate();
...
},
onError: (e, st) {
debugPrint(e.toString());
},
)
- start app in chrome
- Trigger typical user actions such as:
- Switch to another macOS Space
- Minimize the browser window using the “–” button (Dock)
Firebase Core version
4.2.1
Flutter Version
3.32.0
Relevant Log Output
FirebaseError: Remote Config: The stream was not able to connect to the backend: Unable to connect to the server. HTTP status code: undefined. (remoteconfig/stream-error)
Flutter dependencies
Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
Remote Config itself works correctly (fetch/activate and real time change succeeds and values are applied as expected), but this error appears very often and makes the console noisy.
I understand that the stream might fail when the tab/window is backgrounded, but I would expect the SDK to handle this more gracefully, or at least provide an easier way to filter it out on the Dart side.
If you consider this more of a feature request (log behavior change), please feel free to retag.
Hi @noze12, this behaviour originates from the JS SDK. Could you elaborate on what the expected behaviour should be from your point of view?
Thanks for the quick response!
In this specific case, my ideal behavior would actually be not to treat it as an error at all. Minimizing or switching Spaces is a very common, expected user action, so from an app developer’s point of view it feels more like “normal lifecycle noise” than a real error condition.
If it’s difficult or undesirable to completely suppress this on the JS SDK side, the next best thing for me would be for the log message to clearly indicate that this is safe to ignore.
Right now it looks like a generic connection failure, which makes it hard to distinguish from real problems.
Hi @noze12, thanks for the feedback. As mentioned earlier, this error originates from the JS SDK. We simply catch it and surface it to users, so your concern would be best addressed on the JS SDK repository.
Thanks for the clarification — I agree this seems to originate from the JS SDK.
I opened a corresponding issue on the Firebase JS SDK repo with a minimal JS repro: https://github.com/firebase/firebase-js-sdk/issues/9426
Since the root cause/fix likely belongs in the JS SDK, would you prefer that we close this FlutterFire issue and track it on the JS SDK issue instead? I’m happy to keep this open here as a cross-reference as well, whichever is more useful for maintainers.
I'll keep this opened as a cross-reference.