drake035
drake035

Reputation: 2877

Firestore: "There was an unknown error while processing the request"

This is my query:

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);
});

It yields this error:

Error: The query requires an index. You can create it here: https://console.firebase.google.com/project/myprojectlog-bd174/database/firestore/indexes?create_index=EgV0aW1lcxoICgRUYXNr...CGggKBERhdGUQAhoMCghfX25hbWVfXxAC

Problem is, when I click that link I arrive at a page with an error message in the middle: "There was an unknown error while processing the request. Try again". Every single time.

Could there be a typical reason why this happens?

I know I can create a composite index manually but I wasn't able to do so successfully (I tried to create one with Date: ascending, Task: ascending, User: ascending, I'm getting the same error).

Just in case here's a screenshot of the browser console.

Upvotes: 4

Views: 1599

Answers (2)

fractalix
fractalix

Reputation: 451

Verify that the project corresponds with your current account, or try logout / login with the corresponding account for that project.

Upvotes: 4

Revolution88
Revolution88

Reputation: 698

I think you are creating an index on a different project or you are using wrong project ID somewhere in your code. Your URL points to project myprojectlog-bd174, and in browser console screenshot it is timelog-bd174. Or you replaced manually when pasting here in question? :) Try opening that link from browser console in incognito window, you might have been logged in with wrong user on Firebase console or you have reached a limit for free plan.

Upvotes: 1

Related Questions