使用 JavaScript 库运行 Firestore 事务时,我收到 Firebase 错误“错误:由于令牌更改而中止getToken” 。错误不会每次都抛出,我找不到模式。我想我已经在某处实施了一些竞争条件。
我的应用程序中的用户流程是这样的:
Error: getToken aborted due to token change.承诺流程:
firebase.auth().createUserWithEmailAndPassword(email, password)
.catch(signupError => {
// no problems here
})
.then(() => {
return firebase.auth().signInWithEmailAndPassword(email, password)
})
.catch(loginError => {
// no problem here
})
.then((user) => {
// Database write call which fails (see lower code block)
return this.claimInput.writeClaimedPlace(user.user.uid, claimedPlace);
})
.catch(error => {
// "getToken aborted" ERROR GETS CAUGHT HERE, transaction fails …Run Code Online (Sandbox Code Playgroud)