-
Notifications
You must be signed in to change notification settings - Fork 974
Description
Operating System
Windows 11
Environment (if applicable)
Node.js version: 22.19.0
Firebase SDK Version
12.3.0
Firebase SDK Product(s)
Firestore
Project Tooling
- Framework: Angular (v20.2.4)
- Language: TypeScript (v5.8.3)
- Test runner: Playwright (v1.55.0)
- Firebase Emulator Suite (v13.16.0 via firebase-tools)
- Node.js (v22.19.1)
Detailed Problem Description
We are running end-to-end tests with Playwright against our Angular app.
What we were trying to achieve:
We want to simulate user permission changes in our tests by adding and deleting a manager document in Firestore. The UI should react to these changes by redirecting the user back to a summary page.
What actually happened:
Occasionally, the tests fail due to a Firestore internal assertion crash. Instead of the expected redirect, the app crashes with the following error in the console:
@firebase/firestore: Firestore (12.3.0): FIRESTORE (12.3.0) INTERNAL ASSERTION FAILED: Unexpected state (ID: ca9) CONTEXT: {"ve":-1}

This happens only intermittently (flaky). Based on test runs:
First run: 30 tests -> 26 passed, 4 failed
Second run: 30 tests -> 25 passed, 5 failed
This means roughly 15–17% of our runs fail due to this issue. When it doesn’t crash, everything works as expected.
Context:
- The error occurs only when running against the Firebase Emulator.
- It happens when Firestore documents are added and deleted quickly (add manager -> delete manager).
We believe this may be related to: #8250
Steps and code to reproduce issue
We have not been able to create a minimal reproduction, as this error only appears intermittently (flaky) during our Playwright end-to-end tests against the Firestore emulator. However, the issue seems related to rapid document add/delete operations while listening to Firestore against the emulator.
The sequence that seems to trigger it is:
- User is assigned a “manager” role -> Firestore document is added.
- Shortly after, the manager is deleted from Firestore (document removed).
- Our Angular app listens to Firestore snapshot changes and updates the UI.