2

I was using Firestore through the Firebase Javascript SDK in my react-native app using expo, but after ejecting from expo I get this error even though my device is connected to the internet:

@firebase/firestore: Firestore (7.19.1): 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.

How would I fix this, or should I just use the react-native-firebase package?

2
  • I am having the same issue. Commented Sep 9, 2020 at 17:03
  • @ColdCerberus try adding firebase.firestore().settings({experimentalForceLongPolling: true}) to your firebase config.js
    – M. Alex
    Commented Sep 9, 2020 at 20:20

1 Answer 1

2

I was able to fix this by adding this line at the bottom of my firebase config.js:

export const firebase = Firebase.initializeApp(firebaseConfig);
firebase.firestore().settings({experimentalForceLongPolling: true}); // add this

Now firestore works as expected for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.