Skip to content

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

Description

@rob-clother-saible

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions