firebase / firebase/firebase-js-sdk

FIRESTORE (10.12.0) INTERNAL ASSERTION FAILED: Unexpected state

Open
#8,250 66 comments 12 reactions 2 assignees Assigned to @MarkDuckworth View on GitHub
api: firestore needs-attention question
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

iOS 17.4.1

### Browser Version

Mobile Safari UI/WKWebView (AppleWebKit/605.1.15)

### Firebase SDK Version

10.12.0

### Firebase SDK Product:

Firestore

### Describe your project's tooling

Angular web app running on iOS via [Capacitor](https://capacitorjs.com/)
Firestore offline persistence enabled with unlimited cache size

### Describe the problem

For a long time now we have been plagued by this iOS-only issue and have received many reports from users that it's causing the app to stop working and forcing them to restart.

We have captured some Firebase debug logs of this error which I am happy to share privately.

This seems similar to the following issues:
- #8068
- #7712
- #4451

**Example Errors**
- UnknownError: Attempt to get a record from database without an in-progress transaction
- UnknownError: Attempt to get all index records from database without an in-progress transaction
- UnknownError: Connection to Indexed Database server lost. Refresh the page to try again
- FIRESTORE (10.12.0) INTERNAL ASSERTION FAILED: Unexpected state

**Example Stack Trace**
```
Error: FIRESTORE (10.12.0) INTERNAL ASSERTION FAILED: Unexpected state
at fail(node_modules/@firebase/firestore/dist/index.esm2017.js:197:36)
at __PRIVATE_AsyncQueueImpl.Pu(node_modules/@firebase/firestore/dist/index.esm2017.js:18775:16)
at __PRIVATE_AsyncQueueImpl.enqueue(node_modules/@firebase/firestore/dist/index.esm2017.js:18691:14)
at __PRIVATE_AsyncQueueImpl.enqueueAndForget(node_modules/@firebase/firestore/dist/index.esm2017.js:18676:10)
at n(node_modules/@firebase/firestore/dist/index.esm2017.js:14564:15)
at (node_modules/@firebase/firestore/dist/index.esm2017.js:14540:7)
at __PRIVATE_StreamBridge.yo(node_modules/@firebase/firestore/dist/index.esm2017.js:13897:10)
at n(node_modules/@firebase/firestore/dist/index.esm2017.js:14145:81)
at (node_modules/@firebase/firestore/dist/index.esm2017.js:14094:13)
at ab(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:548:22)
at F(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:516:9)
at Z.prototype.ta(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:2162:5)
at Rb(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:1035:129)
at M.prototype.Y(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:904:50)
at M.prototype.ca(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:832:35)
at ab(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:548:22)
at F(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:516:9)
at Wc(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:1582:128)
at h.bb(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:1579:5)
at h.Ea(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:1576:61)
at Lc(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:1474:50)
at h.Pa(node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:1440:27)
at {_ZoneImpl#2}.run(node_modules/zone.js/fesm2015/zone.js:111:37)
at (node_modules/zone.js/fesm2015/zone.js:2299:30)
at {_ZoneImpl#2}.runTask(node_modules/zone.js/fesm2015/zone.js:157:39)
at drainMicroTaskQueue(node_modules/zone.js/fesm2015/zone.js:529:23)
```

### Steps and code to reproduce issue

Steps currently unknown but possibly related to the app going between the background and the foreground over time.

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.