Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@firebase/firestore: Firestore (5.5.9): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. #1457

Closed
Gursewak-Uppal opened this issue Jan 8, 2019 · 5 comments

Comments

@Gursewak-Uppal
Copy link

I have a react native app that uses Firebase/firestore. For uploading images, I am using "react-native-fetch-blob" to create a Blob.

I am trying to fetch doc from firestore, but my app is blocked and not getting any response from firestore (not catch / nothing => just passing thru the code).

Is there anything I can do for getting docs from firestore?

Below is my code

import firebase from "../../../firebaseConfig";
import RNFetchBlob from "react-native-fetch-blob";

// Prepare Blob support
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest;
const Blob = RNFetchBlob.polyfill.Blob;
const fs = RNFetchBlob.fs;
window.Blob = Blob;
const originalXMLHttpRequest = window.XMLHttpRequest;
const originalBlob = window.Blob;

var firebaseUid = "";

componentDidMount = async () => {
firebaseUid = await firebase.auth().currentUser.uid;
this.getMyStory();
};

getMyStory = async () => {
window.XMLHttpRequest = originalXMLHttpRequest;
window.Blob = originalBlob;
var docRef = await firebase
.firestore()
.collection("demo")
.doc(firebaseUid)
.collection("ArrayDoc");
docRef
.get()
.then(querySnapshot => {
querySnapshot.forEach(doc => {
console.log(doc.id, " => ", doc.data());
});
})
.catch(error => {
console.log("error", JSON.stringify(error));
});
};

screenshot 2019-01-07 at 5 19 52 pm

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lopeski
Copy link

lopeski commented Jan 8, 2019

I have the same error.

@mikelehen
Copy link
Contributor

I think there's a known incompatibility with react-native-fetch-blob. See wkh237/react-native-fetch-blob#634 and the workaround suggested here. I would comment on that issue (or maybe open a new one since that one is closed), as I think this is ultimately a problem with react-native-fetch-blob.

@Ovi
Copy link

Ovi commented Feb 20, 2019

This is what I did and it worked for me:

First store window.XMLHttpRequest in a variable
const tempWindowXMLHttpRequest = window.XMLHttpRequest;

Now for RN Fetch Blob, use it's settings
// Prepare Blob support
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest;
const Blob = RNFetchBlob.polyfill.Blob;
const fs = RNFetchBlob.fs;
window.Blob = Blob;
const originalXMLHttpRequest = window.XMLHttpRequest;
const originalBlob = window.Blob;

Then just before making your Firestore call - replace window.XMLHttpRequest with it's old state:
window.XMLHttpRequest = tempWindowXMLHttpRequest;

Hope this would help!

@ngaffa
Copy link

ngaffa commented Jun 28, 2019

You should verify your proxy and/or firewall ports because firebase uses websockets.
I have the same error , it was working when i'm not in proxy and blocked when i am in proxy specially for Cloud Firestore.

@firebase firebase locked and limited conversation to collaborators Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants