@ firebase/firestore:Firestore(5.0.4):无法到达Cloud Firestore后端.后端在10秒内未响应 [英] @firebase/firestore: Firestore (5.0.4): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
问题描述
我正在从事Angular 6项目.这是我使用--prod
构建时遇到的错误
标记,托管并运行.
我已经坐了很长时间了.最初以为这可能是firestore软件包的问题,我等了.
但是现在更新到了Firestore 5.0.4,问题仍然存在.
I am working on an Angular 6 project. This is the error I get when I build with --prod
flag, host and run.
I've been sitting on this for a long time. Initially thought it was probably a problem with the firestore package and i waited.
But now updated to firestore 5.0.4, the problem still exists.
[2018-06-04T06:11:47.859Z] @ firebase/firestore:Firestore(5.0.4):无法访问Cloud Firestore后端.后端在10秒内没有响应.
[2018-06-04T06:11:47.859Z] @firebase/firestore: Firestore (5.0.4): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
这通常表明您的设备当前没有正常的Internet连接.客户端将以脱机模式运行,直到能够成功连接到后端为止.
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.
app.module.ts
app.module.ts
Imports: [
AngularFireModule.initializeApp(environment.firebaseConfig),
AngularFirestoreModule
]
app.component.ts
app.component.ts
constructor(public afAuth: AngularFireAuth,
private afs: AngularFirestore,
private db: AngularFireDatabase) {
this._currentUser = this.afAuth.authState
.pipe(
switchMap((user: any) => {
if (user) {
console.log(user);
return this.afs.collection('users').doc<User>(user.uid).valueChanges();
} else {
return Observable.create(null);
}
})
);
}
仅供参考:身份验证仍然有效.
FYI: Authentication still works.
依赖性 火力地堡5.0.4 angularfire2 5.0.0-rc.10
dependencies firebase 5.0.4 angularfire2 5.0.0-rc.10
推荐答案
您应在Firebase控制台中启用Firestore.请执行以下步骤:
You should enable Firestore in you Firebase Console. Do the following steps:
-
打开, Firebase控制台,打开或创建一个新项目.
Open the Firebase Console, open or create a new project.
在数据库部分中,单击云的入门按钮 Firestore .
In the Database section, click the Get Started button for Cloud Firestore.
选择您的Cloud Firestore安全规则的启动模式:测试模式或锁定模式
Select a starting mode for your Cloud Firestore Security Rules: Test mode or Locked mode
Cloud Firestore和App Engine:您不能在同一项目中同时使用Cloud Firestore和Cloud Datastore ,这可能会影响使用App Engine的应用程序.尝试将Cloud Firestore与其他项目一起使用. 创建Cloud Firestore项目时,它还会在 Cloud API Manager .
Cloud Firestore and App Engine: You can't use both Cloud Firestore and Cloud Datastore in the same project, which might affect apps using App Engine. Try using Cloud Firestore with a different project. When you create a Cloud Firestore project, it also enables the API in the Cloud API Manager.
这篇关于@ firebase/firestore:Firestore(5.0.4):无法到达Cloud Firestore后端.后端在10秒内未响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!