【发布时间】:2018-12-12 09:46:33
【问题描述】:
我正在实施使用 firestore 的 kiosk 项目。
自助服务终端运行时间很长(超过 48 小时)。
但是,有时我的 Firestore onSnapShot 侦听器会通过以下消息出错。
[Error message]
FirebaseError: An internal error occurred.
at new FirestoreError(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:348:28)
at JsonProtoSerializer.fromRpcStatus(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:4919:16)
at JsonProtoSerializer.fromWatchChange(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:5417:44)
at PersistentListenStream.onMessage(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:13092:43)
at ? (C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:13037:34)
at PersistentListenStream.<anonymous>(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:13013:47)
at step(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\tslib\tslib.js:133:27)
at Object.next(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\tslib\tslib.js:114:57)
at ? (C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\tslib\tslib.js:107:75)
at Promise(<anonymous>)
at Object.__awaiter(C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\tslib\tslib.js:103:16)
at ? (C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:13009:62)
at ? (C:\release_pickUp_1210_v15\win-unpacked\resources\app.asar\node_modules\@firebase\firestore\dist\index.node.cjs.js:12485:20)
at ? (<anonymous>)
这是我的代码。
componentDidMount() {
port.open(console.log('port is opend'));
if (TEST) {
port.onRead(this.readFromPCBtest);
} else {
port.onRead(this.readFromPCB);
}
this.unsubscribe = db.onceGetVM().onSnapshot(this.onErrorUpdate);
this.unsubscribeForOrders = db.onceGetOrders().onSnapshot(this.onOrdersUpdate);
this.unsubscribeForCleanings = db.onceGetCleanings().onSnapshot(this.onCleaningsUpdate);
for (let i = 0; i < cleaningList.length; i++) {
unsubscribeForLatestOrders.push(db.onceGetLatestOrders(i).onSnapshot(this.onLatestOrdersUpdate));
unsubscribeForLatestCleanings.push(db.onceGetLatestCleanings(i + 1).onSnapshot(this.onLatestCleaningsUpdate));
}
this.timer = setInterval(this.doClean, TIME_INTERVAL);
}
componentWillUnmount() {
port.close(console.log('port is closed'));
this.unsubscribe();
this.unsubscribeForOrders();
this.unsubscribeForCleanings();
this.unsubscribeForLatestOrders();
for (let i = 0; i < cleaningList.length; i++) {
unsubscribeForLatestOrders[i]();
unsubscribeForLatestCleanings[i]();
}
clearInterval(this.timer);
}
【问题讨论】:
标签: javascript reactjs firebase google-cloud-firestore