Firestore管理员查询在较大的集合上失败

时间:2019-06-21 07:53:51

标签: google-cloud-firestore

我在客户端上构建了一个管理仪表板,在其中我在云中调用一个函数来获取选定集合的文档。函数中的查询如下所示:

  adminDb
    .collection(selectedCollection)
    .get()
    .then(snapshot => {
      if (snapshot.size === 0) throw new functions.https.HttpsError('not-found', 'No entries found')

      return snapshot.docs.map(doc => {
        return {
          id: doc.id,
          data: doc.data(),
        }
      })
    })

对于我来说,这适用于大约500个条目的集合,尽管它已经花费了相当长的时间:

callableAdminGetDocs
Function execution started

callableAdminGetDocs
Function execution took 1298 ms, finished with status code: 204

callableAdminGetDocs
Function execution started

callableAdminGetDocs
Function execution took 4528 ms, finished with status code: 200

查询包含1'800个条目的集合时,出现以下错误:

callableAdminGetDocs
Function execution started

callableAdminGetDocs
Function execution took 14 ms, finished with status code: 204

callableAdminGetDocs
Function execution started

callableAdminGetDocs
Function execution took 19258 ms, finished with status: 'response error'

在客户端时,我收到以下日志:

POST https://us-central1-[].cloudfunctions.net/callableAdminGetDocs 502
[]:1 Access to fetch at 'https://us-central1-[].cloudfunctions.net/callableAdminGetDocs' from origin 'https://[].com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

这是什么问题?使用这些类型的管理查询是否效率低下,因此对于“较大”的集合失败,这是否是一般限制?

0 个答案:

没有答案