Skip to content

Firebase states stuck issue #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jacobgram opened this issue Jul 25, 2024 · 0 comments
Open

Firebase states stuck issue #619

jacobgram opened this issue Jul 25, 2024 · 0 comments

Comments

@jacobgram
Copy link

Version info

React: 18.3.1

Firebase: 10.12.2

ReactFire: not used

Other (e.g. Node, browser, operating system) (if applicable):

Test case

We have the code below placed outside of react

let counter = 0;
const firebaseReadyCheck = setInterval(() => {
  counter++;
  trackEvent({ eventKey: "FIREBASE_READY_CHECK", metaData: { counter } });
  auth
    .authStateReady()
    .then(() => {
      trackEvent({
        eventKey: "FIREBASE_READY_CHECK_SUCCESS",
        metaData: { counter },
      });
      clearInterval(firebaseReadyCheck);
    })
    .catch((e) => {
      trackEvent({
        eventKey: "FIREBASE_AUTH_STATE_READY_ERROR",
        metaData: {
          message: e?.message,
          code: e?.code,
        },
      });
      clearInterval(firebaseReadyCheck);
    });
}, 3000);

Steps to reproduce

The below is the data we got.
For desktop users:
4.18% users wait authStateReady for more than 3 seconds (including below)
2.4% users wait authStateReady for more than 6 seconds
1.42% users wait authStateReady for more than 9 seconds
...

For mobile users:
6.86% users wait authStateReady for more than 3 seconds (including below)
3.6% users wait authStateReady for more than 6 seconds
2.41% users wait authStateReady for more than 9 seconds
...

Waiting for 3/6/9 seconds doesn't mean authStateReady will stuck forever. We do have data showing authStateReady got resolved after 10+ seconds, however most of users won't wait that long.

Similar issue: firebase/firebase-js-sdk#8019

Steps and code to reproduce issue
We recently ( read, last night ) finally found out that you can get this behavior by having multiple tabs open of site for a couple of hours ( we managed to get it after waiting 2h, we don't know if you can get it sooner ), and then opening a new tab to the site. This tab will be stuck. Refreshing any of the other tabs will also result in them being stuck. Closing some of the tabs will result in a stuck tab to become unstuck.

Expected behavior

auth.authStateReady() / auth.onAuthStateChanged() shouldn't stuck

Actual behavior

auth.authStateReady() / auth.onAuthStateChanged() stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant