Could not reach Cloud Firestore backend with Angular Universal and Firebase Functions

Viewed 475

I am trying to perform a simple request to the Firestore on the server-side (Angular Universal runned with firebase serve):

constructor(private afs: AngularFirestore) {
     this.afs.doc<any>('myData').valueChanges().subscribe(resp => console.log(resp));
}

And I am running into issue with connection to the Firestore:

error: [2019-01-06T12:26:14.371Z] @firebase/firestore: Firestore (5.5.9): 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.

  • @angular ver: ^6.1.10
  • @angular/fire ver: ^5.1.1
  • firebase ver: ^5.7.2
1 Answers

If you are running Kaspersky antivirus on your development machine check this issue : Issue

Turning off the antivirus program might help you in that case . Possible workarounds : - first and most important : you must check if your firestore connection details are valid and if your app is really trying to connect to the database . - try logging the firestore errors with : firebase.firestore.setLogLevel('debug') . Then you will be able to give a detailed log about your issue , which will help resolving it. - are you able to access the database from the same machine in firebase console ? - are you serving a --prod build ? If not try it and see if the issue goes away .

Related