firebase / firebase/firebase-js-sdk

Firestore initializes infinite network Channels

Open
#9,183 8 comments 0 reactions 2 assignees Claimed by @MarkDuckworth View on GitHub
api: firestore needs-attention question
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

Mac OS Sequoia 15.5

### Firebase SDK Version

11.10.0

### Firebase SDK Product(s)

Auth, Firestore

### Project Tooling

React App with Vite

### Detailed Problem Description

I've observed that our production application is creating an excessive number of channel requests. We are seeing up to 50 new requests per minute in the browser's network tab, all pointing to Firestore. This behavior occurs even when the user is completely idle. This eventually lead up to over 30k channel calls in a couple of days!

To investigate, I created a minimal reproduction that isolates the Firebase SDK usage (specifically Firestore and Auth). While the rate of new requests is lower in the reproduction due to its simplicity, the number of channel requests still steadily increases over time without any user interaction.

My initial thought was that our data-fetching library, @tanstack/react-query, might be the cause. To rule this out, the reproduction includes two implementations: one using react-query and another using a simple useEffect and useState hook. Both exhibit the same behavior, indicating the issue likely originates within the Firebase SDK.

The reproduction contains a minimal version of our Firebase implementation. If this is caused by an issue in our setup, I would appreciate any guidance on what we need to change.

Thank you for your help!

### Steps and code to reproduce issue

Here is the reproduction repo: https://github.com/TimmNL/firestore-channels-reproduction

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.