Open sAtluna opened 4 months ago
There is also an open stackoverflow question since end of 2022 without answers :disappointed:
@sAtluna Thank you for posting this issue, can you please reverse the order in which you call these methods, I found a SOF answer that suggests that.
@TarekkMA, thanks for the suggestion. I tried it, but unfortunately, it didn't solve the problem. It works fine for Android and iOS, but Flutter Web is throwing the exception. Since all systems should behave the same, I'm led to think this might be a bug in Flutter Web.
Yes, it appears to be coming from the JS side. The app needs to be reinitialized after terminating it using getFiresotre.
JS reproduction: https://github.com/TarekkMA/firebase-js-reproduction/tree/ff/12831
Is there an existing issue for this?
Which plugins are affected?
cloud_firestore
Which platforms are affected?
Web
Description
I am using
await FirebaseFirestore.instance.clearPersistence();
to clear cached data after a user signs out.According to the documentation, this should only be called after terminating the Firestore session.
However, when I attempt to retrieve data again after logging back in, I encounter the following error:
"The client has already been terminated"
Note: This issue only occurs on Flutter Web. It works fine on Flutter mobile.
Are there any steps, which I'm missing? I already tried to recreate the whole Firebase app, but same error.
Reproducing the issue
To reproduce the issue where clearing the cached data after a user signs out causes an error on Flutter Web, follow these steps:
After Sign Out of User: Call the following code to clear the cached data:
Sign In User: Attempt to sign the user back in.
Retrieve Data: Try to retrieve data from Firestore. For example:
var data = await FirebaseFirestore.instance.collection('your_collection').get();
Encounter Error: Observe the following error message:
"FirebaseError: The client has already been terminated."
Note: This issue only occurs on Flutter Web. On Flutter mobile, it works as expected.
Firebase Core version
2.31.1
Flutter Version
3.19.6
Relevant Log Output
Flutter dependencies
Expand
Flutter dependencies
snippet```yaml Replace this line with the contents of your `flutter pub deps -- --style=compact`. ```
Additional context and comments
No response