@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

查看:20
本文介绍了@firebase/firestore:Firestore (5.0.4):无法访问 Cloud Firestore 后端.后端在 10 秒内没有响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 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.

这通常表示您的设备目前没有健康的互联网连接.客户端将在离线模式下运行,直到它能够成功连接到后端.

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.4angularfire2 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:

  1. 打开Firebase 控制台,打开或创建一个新项目.

  1. 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 项目时,它还会启用 云 API 管理器.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆