Skip to content

Firestore SDK onSnapshot doesn't get all responses from fetches. #7641

Closed
@x1i4b1x2

Description

@x1i4b1x2

Operating System

Web

Browser Version

latest chrome

Firebase SDK Version

10.4.0

Firebase SDK Product:

Firestore

Describe your project's tooling

create-react-app, typescript, firebase sdk

Describe the problem

Web Analytics SaaS needs to make fetches in a sequential for-of-loop. For each loop (which represents a document on Firestore) it sets up an onSnapshot to that document. The number of loops usually is between 1 to 10.

Sometimes, when doing a loop of 5-8 fetches it doesn't get a response from all the documents fetched. It sets up the onSnapshot but it doesn't get a response. Then if you retry, of course, it works.

In the case of the image, it received a response from 4 fetches successfully, for the other 2, it waited for a lot and then got the response. But usually, it just waits for a response forever.

Thank you!

Steps and code to reproduce issue

This is how onSnapshot is initiated sequentially in a for-of-loop. The code correctly sets up all the onSnapshot, it is just that sometimes, not all of them receive a response, or sometimes it takes a lot of time for some of them to get a response.

I tried to rate-limit the for each loop, but it still has this error sometimes.

Screenshot 2023-09-21 at 6 08 28 PM

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions