-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firestore appears offline after fetching auth token failed: getToken aborted due to token change error #3179
Comments
I found a few problems with this issue:
|
I am receiving this error as well, but only on the first read attempted as my application boots. Subsequent reads go through well, but this error is completely breaking my linking into my app (data isn't resolved on application load). |
Same here. I even get occasional document read errors saying that 'the client is offline', while it surely isn't. I believe this is happening when a read is executed shortly after or during a token refresh. This makes our application completely unreliable and not suitable for production environments. |
I'm facing the same issue too. |
Hi @aggarwalvinayak, I'm sorry to hear you're having difficulty. Your link to stackblitz is just a general starter project and contains no code. This kind of error can only happen in combination with Firebase Auth. Could you show how your Firestore code is interacting with Firebase Auth? Also could you enable logging and show what you see? In general you need to wait for auth to complete before calling Firestore to avoid problems of this nature, though it seems like you'd have to be doing that to pass the uid to |
Using the following code in a simple html page, I can't reproduce the issue: const firebaseConfig = {
// ...
};
async function main() {
firebase.initializeApp(firebaseConfig);
await firebase.auth().signInAnonymously();
const db = firebase.firestore();
firebase.firestore.setLogLevel('debug')
const snap = await db.collection('foo').doc('bar').get();
console.log(`Found document: exists=${snap.exists}, data=${JSON.stringify(snap.data())}`);
}
main()
.then(() => {
console.log('Success!');
})
.catch((e) => {
console.log(`Failure: ${e}`);
}); |
Sorry i dont know how the stackblitz link got posted. Might be in the demo issue template. |
I got it, too! |
I got the same issue and I code with Vue.js. I tried the simple example of @wilhuff like that:
But here is my console log:
I wrote two different functions, because of the problem, that only from the second (third, ..., nth) request on it's not working anymore. If you log in the first time everything works fine. When I clear the Browsers Storage (IndexdDB) I can start with one working attempt again. So you can see the first attempt works fine (how it should) and the second gets this error:
|
Having the same issue with v7.15.0 on a React app with redux-saga
Downgrading to v7.14.2 as @gitCoy mentioned fixed the issue |
@schlakob Thanks for your notes. I'm able to reproduce the error you've seen. It turns out that this error first occurs in 7.14.6. #3184 treats the symptom, but there's been a change in behavior here that I'll be able to track down based on this. Here's my reproduction: const firebaseConfig = {
// ...
};
firebase.initializeApp(firebaseConfig);
async function testFunction() {
await firebase.auth().signInWithEmailAndPassword('****', '****');
const db = firebase.firestore();
firebase.firestore.setLogLevel('debug')
const doc = db.collection('foo').doc('bar');
const snap = await doc.get();
console.log(`Found document: exists=${snap.exists}, data=${JSON.stringify(snap.data())}`);
}
async function main() {
await testFunction();
await testFunction();
}
main()
.then(() => {
console.log('Success!');
})
.catch((e) => {
console.log(`Failure: ${e}`);
}); |
We were able to verify that this has been fixed with #3184, which should be released this week. |
*bump. This issue fixes for me after signing a user out. But that is not a workable solution. |
[2020-06-06T14:37:20.739Z] @firebase/firestore: Firestore (7.15.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unknown]: Fetching auth token failed: getToken aborted due to token change.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
Found this bug while using .get() in a document. Not able to even get the full database with collection. Was working few hours ago.. Found that other users also experienced this while using this version. Was fixed after moving to a previous version of it.
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
To reproduce try to get any data from the firestore using .collection().doc().get()
Relevant Code:
https://stackblitz.com/fork/firebase-issue-sandbox
The text was updated successfully, but these errors were encountered: