I am using firebase with firestore in a Chrome Extension. Now and then I get this error message. I suspect it is triggered when the computer enters sleep mode for a certain amount of time:
Firestore (8.10.0): Connection WebChannel transport errored
I use the following setup:
const firebaseApp = firebase.initializeApp(firebaseConfig.app);
const firebaseUi = new firebaseui.auth.AuthUI(firebase.auth());
firebase.firestore().settings({
useFetchStreams: false,
experimentalForceLongPolling: true,
experimentalAutoDetectLongPolling: true,
merge: true
});
None of those settings have worked out for me. Not alone, not mixed. I need to use the option "merge" to avoid another error. I also can't catch this error with try { } catch {}, which is rather unsatisfying since this issue throws a visible error in the Chrome Extensions page.
I am quite sure this is due to snapshot listeners that get disconnected. I tried to catch the error there with a function as a second argument to log the error:
ref.onSnapshot(
(snapshot) => {
...
},
(e) => {
console.log(e);
}
);
Sadly, this was as unsuccessful as well. Any ideas on how to catch that error? I've never experienced an issue functionality-wise.