Skip to content

auth.onAuthStateChanged + firestore.onSnapshot cause infinite loop of calls to /token. #3222

@notVitaliy

Description

@notVitaliy

[REQUIRED] Describe your environment

  • Operating System version: Windows 10
  • Browser version: Chrome && Firefox
  • Firebase SDK version: >=7.10.0
  • Firebase Product: Auth

[REQUIRED] Describe the problem

Calls to onAuthStateChanged and onIdTokenChanged send off a flurry of requests to securetoken.googleapis.com/v1/token until it responds with QUOTA_EXCEEDED. This only happens when the user is authenticated.

Steps to reproduce:

This error does not occur on Linux or macOS. I was not able to replicate it in a windows VM on Linux. It's only on windows in both firefox and chrome. However, I've only had success replicating with 2 windows machines and failed to replicate on another windows laptop.

  1. Only windows (maybe?)
  2. go to the stackblitz link
  3. authenticate with email (random email + password should work)
  4. uncomment line 42
  5. refresh the app stackblitz preview window
  6. check network tab, there should be 100's of requests

https://stackblitz.com/edit/firebase-issue-sandbox-vzdnt7

This is the strangest bug that I've run across and it took quite a bit to isolate the exact sequence of events that was causing it.

My initial thoughts are that calls to the firestore document snapshot are causing the onAuthStateChanged observer to trigger.

edit: I just did some more digging and this bug does not happen in 7.9.3 but does in 7.10.0

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions