My config file:
import * as firebase from "firebase/app";
import { getAuth, GoogleAuthProvider, signInWithCredential } from "firebase/auth";
import { getFirestore, setDoc, doc, getDoc, updateDoc } from 'firebase/firestore';
const firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "xxx",
appId: "xxx",
measurementId: "xxx",
databaseURL: "xxx"
};
if (!firebase.getApps().length) {
firebase.initializeApp(firebaseConfig);
}
const firestore = getFirestore(firebase.getApp());
export { getAuth, GoogleAuthProvider, signInWithCredential, firestore, setDoc, doc, getDoc, updateDoc };
export default firebase;
When I try to setDoc
or getDoc
it always throws the following error:
@firebase/firestore: Firestore (9.9.3): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
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.
or
[FirebaseError: Failed to get document because the client is offline.]
I've also tried with versions 9.9.2, 9.9.1, 9.9.0 and 9.8.0 but always the same... Any idea why I cannot connect? My internet connection is stable and I've tried it on my Android phone and emulator.