swup
October 26, 2021, 1:11pm
#1
Does Firebase 9 actually work for anyone on Expo 43 ?
As per the release notes, Recommended firebase version is now 9.0.2. When you run expo upgrade, we will install the new modularfirebase library in your project if you use firebase
So, I’ve upgraded one of my apps to Expo v43, and given the above, I’ve also ported it to Firebase v9.
Now, regardless of the Expo version I install v9 on (tested with 41 and 43), whenever I try to pull any data from Firestore, it says “Could not reach Cloud Firestore backend ”. Keep in mind that the Auth works, it’s just the Firestore module crapping out.
I’ve tested the following (brand new expo init setups):
Firebase 8 with Expo 41 (everything works)
Firebase 9 with Expo 41 (auth works, firestore doesn’t)
Firebase 9 with Expo 43 (auth works, firestore doesn’t)
Any clue? Is it just me?
Later edit: Just for fun, I’ve installed expo-firebase-starter which has been updated to expo 43 and firebase 9. Now, it doesn’t have any actual firestore code, and so I’ve added some lines, then sent it to a few of my friends to try it out as well.
Same error, firestore client backend could not be reached.
sun23
October 31, 2021, 2:27am
#2
I think this will help you
opened 06:46AM - 26 Oct 21 UTC
api: firestore
v9
### [REQUIRED] Describe your environment
* Firebase SDK version: 9.1.3
*… Firebase Product: firestore
### [REQUIRED] Describe the problem
I just started updating my code from Firebase v8 to v9 and then started running into this issue (which is weird because it was just working before I upgraded to v9 so I'm pretty sure it's not a network issue)
It seems like some firebase features do work, for eg the onAuthStateChange from firebase.auth, but whenever I try and run a Firestore command it seems to get stuck.
```
[2021-10-26T06:31:58.335Z] @firebase/firestore:, Firestore (9.1.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.
at node_modules/@firebase/util/dist/index.esm2017.js:1737:21 in stringLength
at node_modules/@firebase/util/dist/index.esm2017.js:1881:0 in <global>
at http://192.168.0.63:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:127402:19 in F
at node_modules/@firebase/firestore/dist/index.rn.js:10137:8 in <global>
at http://192.168.0.63:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:139150:48 in <unknown>
at node_modules/@firebase/firestore/dist/index.rn.js:10653:10 in <global>
at node_modules/@firebase/firestore/dist/index.rn.js:14006:24 in <global>
at node_modules/@firebase/firestore/dist/index.rn.js:14048:19 in cancel
at [native code]:null in flushedQueue
at [native code]:null in callFunctionReturnFlushedQueue
```
#### Relevant Code:
```javascript
// Initialization
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
const firebaseApp = initializeApp({
// Initialization keys go here
});
const auth = getAuth();
const db = getFirestore();
const storage = getStorage();
export { auth, db, storage };
/////////////////////////////////////////////////////// IN A SEPARATE FILE ///////////////////////////////////////////////////////
import { onAuthStateChanged } from "firebase/auth";
import { auth, db } from "./firebase";
import {
addDoc,
collection,
doc,
getDoc,
getDocs,
limit,
orderBy,
query,
updateDoc,
where,
} from "firebase/firestore";
const SomeComponent = () => {
// other stuff
useEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
(async () => {
if (user) {
let _userDoc;
try {
_userDoc = await getDocs(collection(db, "users"));
// _userDoc = await getDoc(doc(db, "users", user.uid));
} catch (e) {
console.error(e);
}
console.log("bello");
if (_userDoc.exists()) {
setUserDoc(_userDoc);
const userProdSnap = await getDocs(
collection(_userDoc, "userProducts")
);
let curUserProducts = [];
userProdSnap.forEach((doc) => curUserProds.push(doc.data()));
setUserProducts(curUserProducts);
} else {
console.error("ERROR: user document doesn't exist");
}
}
})();
});
return unsubscribe;
}, []);
}
```
opened 06:46AM - 26 Oct 21 UTC
api: firestore
v9
### [REQUIRED] Describe your environment
* Firebase SDK version: 9.1.3
*… Firebase Product: firestore
### [REQUIRED] Describe the problem
I just started updating my code from Firebase v8 to v9 and then started running into this issue (which is weird because it was just working before I upgraded to v9 so I'm pretty sure it's not a network issue)
It seems like some firebase features do work, for eg the onAuthStateChange from firebase.auth, but whenever I try and run a Firestore command it seems to get stuck.
```
[2021-10-26T06:31:58.335Z] @firebase/firestore:, Firestore (9.1.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.
at node_modules/@firebase/util/dist/index.esm2017.js:1737:21 in stringLength
at node_modules/@firebase/util/dist/index.esm2017.js:1881:0 in <global>
at http://192.168.0.63:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:127402:19 in F
at node_modules/@firebase/firestore/dist/index.rn.js:10137:8 in <global>
at http://192.168.0.63:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:139150:48 in <unknown>
at node_modules/@firebase/firestore/dist/index.rn.js:10653:10 in <global>
at node_modules/@firebase/firestore/dist/index.rn.js:14006:24 in <global>
at node_modules/@firebase/firestore/dist/index.rn.js:14048:19 in cancel
at [native code]:null in flushedQueue
at [native code]:null in callFunctionReturnFlushedQueue
```
#### Relevant Code:
```javascript
// Initialization
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
const firebaseApp = initializeApp({
// Initialization keys go here
});
const auth = getAuth();
const db = getFirestore();
const storage = getStorage();
export { auth, db, storage };
/////////////////////////////////////////////////////// IN A SEPARATE FILE ///////////////////////////////////////////////////////
import { onAuthStateChanged } from "firebase/auth";
import { auth, db } from "./firebase";
import {
addDoc,
collection,
doc,
getDoc,
getDocs,
limit,
orderBy,
query,
updateDoc,
where,
} from "firebase/firestore";
const SomeComponent = () => {
// other stuff
useEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
(async () => {
if (user) {
let _userDoc;
try {
_userDoc = await getDocs(collection(db, "users"));
// _userDoc = await getDoc(doc(db, "users", user.uid));
} catch (e) {
console.error(e);
}
console.log("bello");
if (_userDoc.exists()) {
setUserDoc(_userDoc);
const userProdSnap = await getDocs(
collection(_userDoc, "userProducts")
);
let curUserProducts = [];
userProdSnap.forEach((doc) => curUserProds.push(doc.data()));
setUserProducts(curUserProducts);
} else {
console.error("ERROR: user document doesn't exist");
}
}
})();
});
return unsubscribe;
}, []);
}
```
system
closed
November 20, 2021, 2:28am
#3
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.