Description
[REQUIRED] Describe your environment
- Operating System version: windows 10 (v21H2)
- Browser version: react-native 0.67.3
- Firebase SDK version: 9.6.7
- Firebase Product: database , firestore , auth
[REQUIRED] Describe the problem
I saw the #5836 and many others on Stack Overflow, i'm facing the same issue i recreated a few time test projects to try connect to Firestore but since i am using firebase v9 modular i can't access the database, same problem on my physical device (SM-A520F - 8.0.0) android 8 and on many emulators using android studio (Pixel, Pixel 2, Pixel 3, Pixel 4) different android version from 8 to 10.
the error is always the same :ERROR [2022-02-27T23:03:53.595Z] @firebase/firestore: Firestore (9.6.7): 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.
LOG [FirebaseError: Failed to get document because the client is offline.]
Steps to reproduce:
Create react app using
npx react-native init AppName
Install firebase :
npm i firebase
Go in App.js and try this :
Relevant Code:
//App.jsimportReactfrom'react';import{Text,View,TouchableOpacity}from'react-native';import{initializeApp}from'firebase/app';import{getFirestore,doc,getDoc}from"firebase/firestore";constfirebaseConfig={apiKey: "AIzaSyB-57*****************************",authDomain: "***********.firebaseapp.com",projectId: "***********",storageBucket: "***********.appspot.com",messagingSenderId: "28**********",appId: "1:28*************************************",measurementId: "G-5*********"};constapp=initializeApp(firebaseConfig);constFirestore=getFirestore(app)constApp=()=>{asyncfunctiononPress(){constmy_doc=awaitgetDoc(doc(Firestore,'/CollectionName/DocumentID'))console.log(my_doc.data())}return(<View><TouchableOpacityonPress={onPress}><Text>Press Here</Text></TouchableOpacity></View>);};exportdefaultApp;
when i press the Text i wait 10-12s and the console return me the error above, the exact same error on all my support, i have did all my test with the same PC, i will try on another asap.
I am stuck with this from a long time now and i don't understand the problem, i have a excellent connection (more than 100mb/s) when i do speedtest on my device or my emulators.