Creating a collectionGroup exemption index in the Firebase Hosting console fixes the problem. However subsequent hosting deploys break the exemption and scheduled function.
Deploying firebase.indexes.json (firebase deploy --only firestore) also breaks exemption index created in the Firebase console, even when the firebase.indexes.json is the same as the output of firebase firestore:indexes. The exemption fails with Error: 9 FAILED_PRECONDITION
Deleting the exemption created in the console & deploying the firebase.indexes.json, creates the expected exemption, but it fails with Error: 9 FAILED_PRECONDITION.
[REQUIRED] Steps to reproduce
Create a collection that includes a subcollection called "reports" & a scheduled function to remove documents in any collection called "reports".
Creating an index collectionGroup exemption in the console fixes the scheduled function run. However, subsequent hosting deployments cause the function to break.
The only way to fix the function is to deploy an empty firebase.indexes.json ({}), deleting the index exemption in the console, and recreating the index in the console. Any hosting deployments break the scheduled function.
[REQUIRED] Environment info
firebase-tools: 13.11.2
Platform: masOS
[REQUIRED] Test case
A scheduled function fails with Error: 9 FAILED_PRECONDITION.
Creating a collectionGroup exemption index in the Firebase Hosting console fixes the problem. However subsequent hosting deploys break the exemption and scheduled function.
Deploying firebase.indexes.json (firebase deploy --only firestore) also breaks exemption index created in the Firebase console, even when the firebase.indexes.json is the same as the output of firebase firestore:indexes. The exemption fails with Error: 9 FAILED_PRECONDITION
Deleting the exemption created in the console & deploying the firebase.indexes.json, creates the expected exemption, but it fails with Error: 9 FAILED_PRECONDITION.
[REQUIRED] Steps to reproduce
Create a collection that includes a subcollection called "reports" & a scheduled function to remove documents in any collection called "reports".
[REQUIRED] Expected behavior
The scheduled function runs and deletes the expected documents.
Deploying firebase.indexes.json with the following form creates the index exemption and the scheduled function succeeds:
[REQUIRED] Actual behavior
The scheduled function fails with Error: 9 FAILED_PRECONDITION.
Creating an index collectionGroup exemption in the console fixes the scheduled function run. However, subsequent hosting deployments cause the function to break.
The only way to fix the function is to deploy an empty firebase.indexes.json ({}), deleting the index exemption in the console, and recreating the index in the console. Any hosting deployments break the scheduled function.