Skip to content

onConfigUpdated emits error when the page becomes hidden #9426

@noze12

Description

@noze12

Operating System

macOS Sequoia

Environment (if applicable)

Chrome

Firebase SDK Version

12.6.0

Firebase SDK Product(s)

Remote-Config

Project Tooling

none.
(I use flutter firebase lib for flutter web and noticed this behavior: firebase/flutterfire#17901 )

Detailed Problem Description

onConfigUpdated with error handler emits the following error repeatedly when the page becomes hidden (e.g. switching tabs or minimizing the browser window):

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).
    at RealtimeHandler.prepareAndBeginRealtimeHttpStream (realtime_handler.ts:633:35)

Since the SDK already tracks background state via isInBackground, would it make sense to guard this else block as well?

Steps and code to reproduce issue

import { initializeApp } from "https://www.gstatic.com/firebasejs/12.6.0/firebase-app.js"
import { getRemoteConfig, onConfigUpdate } from "https://www.gstatic.com/firebasejs/12.6.0/firebase-remote-config.js"

const firebaseConfig = {
  // config
};

const app = initializeApp(firebaseConfig);
const remoteConfig = getRemoteConfig(app);

onConfigUpdate(remoteConfig, {
  next: (configUpdate) => {
    console.log("Updated keys:", configUpdate.getUpdatedKeys());
  },
  error: (error) => {
    console.error(error);
  },
  complete: () => {
    console.log("Listening stopped.");
  }
});
  1. Load js
  2. Switch tab

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions