We have two environments: staging and production.
I recently deployed to our staging server, and got some errors, 'The query requires an index'. This I fixed by following the link it provides. Because I knew we'd be deploying the same code to production later too, I adjusted the link which took me to add the same keys to production as well. This *appeared* to work...
...until I just deployed production yesterday, and now I'm getting the same errors. After reviewing the database, the indexes were deleted.
Why would they have been deleted?
EDIT:
Worse than this, the indexes on the staging Firestore were also deleted, and now I'm getting the same errors on staging too. Is there a way to make indexes permanent? Or does Firestore require users to add them every few days..?
Solved! Go to Solution.
It appears that our setup deploys firestore.indexes.json, which in our case has been empty (I didn't realize what this was or how it worked, esp. since the index error messages so helpfully guide users to add indexes to the *cloud* Firestore database directly, NOT to this file.)
I've now disabled deployment of this file (by removing the "firestore.indexes.json" reference from the firebase.json file).
It appears that our setup deploys firestore.indexes.json, which in our case has been empty (I didn't realize what this was or how it worked, esp. since the index error messages so helpfully guide users to add indexes to the *cloud* Firestore database directly, NOT to this file.)
I've now disabled deployment of this file (by removing the "firestore.indexes.json" reference from the firebase.json file).