firebase / firebase/firebase-js-sdk

`onSnapshot` getting out of sync when `useFetchStreams` enabled and brittle network

Open
#8,903 13 comments 1 reaction 1 assignee Assigned to @MarkDuckworth View on GitHub
api: firestore needs-attention question Repro Needed
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

primarily Android, but not always

### Environment (if applicable)

primarily on mobile devices, but not always

### Firebase SDK Version

11.6.0

### Firebase SDK Product(s)

Firestore

### Project Tooling

Web app with Webpack

### Detailed Problem Description

We're seeing that for some users, `onSnapshot` for a query does not keep up with changes on the server. It seems to miss a change and it does not catch up later.

Unfortunately we can not reproduce the issue at will. It seems to be some race condition that only happens on brittle internet connections and we do not have a setup to hammer a test with simulated connection issues until we could see it happening.

What we can see in our error tracking is that in many occurrences the browser has the error `@firebase/firestore: Firestore (11.6.0): WebChannelConnection RPC 'Listen' stream 0x24eae879 transport errored: [object Object]` earlier in its JS console logs.

We also found out that if we pass `useFetchStreams: false` to `initializeFirestore`, then the issue goes away completely.

### Steps and code to reproduce issue

-

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.