Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[cloud_firestore_web] Regression in 6.10.0: Document snapshot streams stall on Web after authentication state transition

Aperta
#18,700 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
dart
Ambito
databases, web-dev

Direzione di ricerca

Reproduce the Flutter Web regression with cloud_firestore 6.10.0 and firebase_core_web 3.12.0, then compare it with the working 6.9.0 and 3.11.0 versions. Start from the logged WebChannel and stream paths in webchannel_connection.ts, remote_store.ts, persistent_stream.ts, and sync_engine_impl.ts; done means authenticated snapshots emit initial and subsequent events without the stream hanging.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

blocked: customer-response platform: web plugin: cloud_firestore type: bug
Is there an existing issue for this?
  • I have searched the existing issues.
Which plugins are affected?

Cloud Functions, Database

Which platforms are affected?

Web

Description
Description

Following the update from cloud_firestore: 6.9.0 (firebase_core_web: 3.11.0) to cloud_firestore: 6.10.0 (firebase_core_web: 3.12.0), Firestore document snapshot streams (doc(...).snapshots()) fail to emit data or deliver snapshot events on Flutter Web.

Native platforms (macOS / iOS / Android) are unaffected and continue to work as expected.

Pinning cloud_firestore: 6.9.0 (and firebase_core_web: 3.11.0) immediately resolves the issue without any changes to application code.

Reproducing the issue
  1. Configure a Flutter Web application with cloud_firestore: 6.10.0 and firebase_auth: 6.7.0 (or firebase_core_web: 3.12.0).
  2. Authenticate a user via Firebase Auth (e.g., custom token or standard provider).
  3. Listen to a document snapshot stream:
    FirebaseFirestore.instance
        .collection('users')
        .doc(userId)
        .snapshots()
        .listen((snapshot) {
          print('Received snapshot: ${snapshot.data()}');
        });
    
  4. Observe network activity in Chrome DevTools:
  • WebChannel establishes an initial handshake (Listen/channel).
  • Following the auth state transition, the unauthenticated WebChannel session is terminated (TYPE=terminate / aborted GET long-poll with Unknown SID).
  • The subsequent snapshot listener on the authenticated session never emits events to the Dart stream listener; the stream hangs indefinitely with no error or data emitted.
Expected Behavior

snapshots() should emit document snapshots when listening to accessible documents on Flutter Web, matching the behavior in cloud_firestore: 6.9.0.


Actual Behavior

The stream hangs and never emits the initial document snapshot or subsequent updates. No error is thrown through .handleError().

Firebase Core version

4.15.0

Flutter Version

3.47.2

Relevant Log Output
// 1. Initial WebChannel Listen handshake and subscription registration (Pre-Auth / Transition)
webchannel_connection.ts:317 Fetch finished loading: POST "https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel?VER=8&database=projects%2F<PROJECT_ID>%2Fdatabases%2F(default)&RID=36868&CVER=22&X-HTTP-Session-Id=gsessionid&zx=o6xdvuy44xqx&t=1"
    (anonymous) @ stream_controller.dart:618
    (anonymous) @ js_allow_interop_patch.dart:367
    __PRIVATE_onWatchStreamOpen @ remote_store.ts:572
    (anonymous) @ persistent_stream.ts:532
    then @ async_queue_impl.ts:137

// 2. Target added to listen to document snapshot
webchannel_connection.ts:333 Fetch finished loading: POST "https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel?VER=8&database=projects%2F<PROJECT_ID>%2Fdatabases%2F(default)&gsessionid=<GSESSION_ID>&SID=Xe1mhnSSZdjYxYx5OqJXQw&RID=36869&AID=1&zx=6iucu6uk4c7m&t=1"
    (anonymous) @ stream_controller.dart:618
    (anonymous) @ js_allow_interop_patch.dart:367
    asyncQueue @ firestore_client.ts:528

// 3. User authenticates via Firebase Auth. Unlisten / session teardown triggered:
__PRIVATE_syncEngineImpl @ sync_engine_impl.ts:482
__PRIVATE_eventManagerUnlisten @ event_manager.ts:271
fromCache @ firestore_client.ts:795
then @ async_queue_impl.ts:137

// 4. In-flight WebChannel long-poll GET is terminated / aborted:
webchannel_connection.ts:317 Fetch failed loading: GET "https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel?gsessionid=<GSESSION_ID>&VER=8&database=projects%2F<PROJECT_ID>%2Fdatabases%2F(default)&RID=rpc&SID=Xe1mhnSSZdjYxYx5OqJXQw&AID=0&CI=0&TYPE=xmlhttp&zx=x6izydofjgit&t=1"
    (anonymous) @ webchannel_blob_es2018.js:49
    (anonymous) @ webchannel_blob_es2018.js:57
    Eb @ webchannel_blob_es2018.js:25

// 5. Querying the terminated SID endpoint returns 400 Bad Request:
// HTTP/2 400 Bad Request
// <!DOCTYPE html>
// <html lang=en><title>Error 400 (Bad Request)!!1</title>
// <p><b>400.</b> <ins>That’s an error.</ins>
// <p>Your client has issued a malformed or illegal request. Unknown SID <ins>That’s all we know.</ins>

// 6. Result:
// The authenticated snapshot stream listener fails to deliver events to the Dart StreamSubscription.
// Document exists and is readable via authenticated REST API, but Stream<DocumentSnapshot> hangs indefinitely.
Flutter dependencies
  • Failing Versions:

    • cloud_firestore: 6.10.0
    • cloud_firestore_web: 5.7.4 (or transitive 5.7.3 with firebase_core_web: 3.12.0)
    • firebase_core_web: 3.12.0 (bundled Firebase JS SDK 12.19.0)
  • Working Versions:

    • cloud_firestore: 6.9.0
    • cloud_firestore_web: 5.7.3
    • firebase_core_web: 3.11.0 (bundled Firebase JS SDK 12.18.0)
Additional context and comments
  • In Chrome DevTools Network panel, the previous WebChannel long-polling channel aborts when authentication completes, and any subsequent poll to the terminated session ID returns 400 Bad Request (Unknown SID).

  • Verified via authenticated Firestore REST API (GET https://firestore.googleapis.com/v1/projects/<PROJECT>/databases/(default)/documents/...) that the target document exists and security rules permit read access with the active auth token.

  • Reverting solely the FlutterFire dependencies back to cloud_firestore: 6.9.0 and firebase_core_web: 3.11.0 (Firebase JS SDK 12.18.0) restores stream emissions immediately.

Lingua principale
Dart
Stelle
9.3k
Fork
4.1k
Merge medio
1g 14h
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/flutterfire

Tutte le issue di firebase/flutterfire

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.