Firestore:“处理请求时出现未知错误”

时间:2018-11-20 20:58:54

标签: vue.js google-cloud-firestore

这是我的查询

var timesRef = db.collection('times');
var timesWeek = timesRef
  .where('Date', '>=', this.mon)
  .where('Date', '<=', this.sun)
  .where('Task', '==', this.task)
  .where('User', '==', this.user);
timesWeek.get()
.then(function(querySnapshot) {
  querySnapshot.forEach(function(doc) {
    console.log(doc.data());
  });
})
.catch(function(error) {
  console.log('Error getting documents: ', error);
});

它会产生此错误:

  

错误:查询需要索引。您可以在这里创建它:   https://console.firebase.google.com/project/myprojectlog-bd174/database/firestore/indexes?create_index=EgV0aW1lcxoICgRUYXNr...CGggKBERhdGUQAhoMCghfX25hbWVfXxAC

问题是,当我单击该链接时,我到达一个页面,中间出现错误消息:"There was an unknown error while processing the request. Try again"。每一次。

为什么会发生这种情况?

我知道我可以手动创建一个复合索引,但是我无法成功创建(我尝试使用Date: ascendingTask: ascendingUser: ascending创建一个索引出现相同的错误)。

以防万一,这里是screenshot of the browser console

2 个答案:

答案 0 :(得分:2)

验证该项目是否与您当前的帐户相对应,或尝试注销/登录该项目的相应帐户。

答案 1 :(得分:0)

我认为您正在其他项目上创建索引,或者您在代码中的某处使用了错误的项目ID。您的URL指向项目myprojectlog-bd174,在浏览器控制台屏幕快照中为timelog-bd174。还是在有问题的地方粘贴时手动更换了? :)尝试在隐身窗口中从浏览器控制台打开该链接,可能您在Firebase控制台上以错误的用户身份登录,或者您已达到免费套餐的限制。

相关问题