无法使用Angular Universal和Firebase函数访问Cloud Firestore后端

时间:2019-01-06 13:15:32

标签: node.js typescript firebase google-cloud-firestore angular-universal

我正在尝试向服务器端的Firestore执行一个简单的请求(以firebase serve运行的Angular Universal):

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

我在与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.

  • @角版本:^ 6.1.10
  • @ angular / fire版本:^ 5.1.1
  • firebase版本:^ 5.7.2

1 个答案:

答案 0 :(得分:1)

如果您在开发计算机上运行卡巴斯基反病毒软件,请检查此问题:Issue

在这种情况下,关闭防病毒程序可能会对您有所帮助。 可能的解决方法: -首先也是最重要的一点:您必须检查您的Firestore连接详细信息是否有效,以及您的应用是否确实在尝试连接数据库。 -尝试使用以下命令记录firestore错误:firebase.firestore.setLogLevel('debug')。然后,您将能够提供有关您的问题的详细日志,这将有助于解决该问题。 -您是否可以在Firebase控制台的同一台计算机上访问数据库? -您要提供--prod版本吗?如果没有尝试,看看问题是否消失。