angular / angular/angularfire

Attempt to get a record from database without an in-progress transaction

未关闭
#3,342 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
22 小时 28 分钟
30 天内合并 PR
6

描述

### Version info

**Angular:** 14.2.8

**Firestore:** 9.15.0

**AngularFire:** 7.5.0

**Ionic:** 6.1.9

**iOS:** 16.1.1 iPhoneSE (error also happens on newer versions)

### How to reproduce these conditions

**Steps to set up and reproduce**

* Setup of `app.module.ts`:
```typescript
// ...
import { initializeApp, provideFirebaseApp } from '@angular/fire/app';
import { AngularFireAuthModule } from '@angular/fire/compat/auth';
import { FirestoreService } from './services/firestore.service';
import { AngularFireModule } from '@angular/fire/compat';
import { AngularFirestoreModule } from '@angular/fire/compat/firestore';

@NgModule({
declarations: [
AppComponent // ...
],
imports: [
// ...
IonicModule.forRoot(),
// ...
AngularFireModule.initializeApp(environment.firebase),
AngularFireAuthModule,
AngularFirestoreModule.enablePersistence(),
provideFirebaseApp(() => initializeApp(environment.firebase)),
],
providers: [
FirestoreService,
// ...
],
bootstrap: [AppComponent],
})
export class AppModule {}

```
* sync build to ios device
* lock screen (it's hard to actually reproduce)

### Debug output

```
[Error] [2023-04-25T07:19:43.604Z] @firebase/firestore: – "Firestore (9.15.0): INTERNAL UNHANDLED ERROR: " – "Attempt to get a record from database without an in-progress transaction"

error
defaultLogHandler (vendor.js:231226)
error (vendor.js:231332)
x (vendor.js:40775)
(anonymous function) (vendor.js:62299)
(anonymous function) (polyfills.js:300)
(anonymous function) (polyfills.js:1720)
(anonymous function) (polyfills.js:357)
drainMicroTaskQueue (polyfills.js:827)
(anonymous function) (polyfills.js:705)
invokeTask (polyfills.js:2220)
globalCallback (polyfills.js:2257)

[Error] [2023-04-25T07:20:21.926Z] @firebase/firestore: – "Firestore (9.15.0): FIRESTORE (9.15.0) INTERNAL ASSERTION FAILED: Unexpected state"

error
defaultLogHandler (vendor.js:231226)
error (vendor.js:231332)
x (vendor.js:40775)
O (vendor.js:40859)
zc (vendor.js:62312)
enqueue (vendor.js:62217)
enqueueAndForget (vendor.js:62200)
handleDelayElapsed (vendor.js:58208)
timer (polyfills.js:3714)
onInvokeTask (vendor.js:197041)
(anonymous function) (polyfills.js:357)
(anonymous function) (polyfills.js:702)
```

### Actual behavior

After the screen gets locked on an iOS device, Firestore gets into an unexpected state and none of the Angular routes that use firebase queries can be accessed anymore. We only query data of our firebase instance, so there shouldn't be transaction issues.

贡献指南

打开贡献指南

调研方向

从 app.module.ts 的设置开始,尤其是 AngularFirestoreModule.enablePersistence(),并通过锁定屏幕在 iOS 设备上重现问题。将 Firestore 9.15.0 的错误与受影响的 Angular 路由和 FirestoreService 的使用情况进行比较;当解锁后内部错误不再导致 Firebase 查询和路由无法使用时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, firebase, ios, typescript
领域
database, mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。