firebase deploy firebase:indexes fails when any index was already created
See original GitHub issue[REQUIRED] Environment info
firebase-tools: 7.0.2
Platform: Ubuntu
[REQUIRED] Test case
v1: indexes.json
{
"indexes": [
{
"collectionGroup": "authors",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "name",
"order": "ASCENDING"
},
{
"fieldPath": "born",
"order": "ASCENDING"
}
]
}
]
}
v2: indexes.json: added new index
{
"indexes": [
{
"collectionGroup": "authors",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "name",
"order": "ASCENDING"
},
{
"fieldPath": "born",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "authors",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "name",
"order": "ASCENDING"
},
{
"fieldPath": "born",
"order": "DESCENDING"
}
]
}
]
}
[REQUIRED] Steps to reproduce
- run
firebase deploy --only firestore:indexes
with first version ofindexes.json
- update file with additional index and re-run
[REQUIRED] Expected behavior
Both commands are successful and target firestore database contains both indices
[REQUIRED] Actual behavior
First run succeeds, but latter fails with error: Error: HTTP Error: 409, index already exists
. Only first index is present.
Workaround
- Delete all indexes before deploy
- Place in indexes.json only indexes not present in database.
It would seems this has been caused by: #1120
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:17 (5 by maintainers)
Top Results From Across the Web
Manage indexes in Cloud Firestore - Firebase - Google
Create a missing index through an error message. Use the Firebase console. Remove indexes; Use the Firebase CLI; Index build time. Listing all...
Read more >Error: path-to-file/firestore.indexes.json does not exist
Your firebase.json files has an instruction to deploy security rules and predefined indexes to Firestore here:
Read more >Managing indexes | Firestore - Google Cloud
Create a missing index through an error message; Use the Google Cloud Platform Console ... but these links will always open in the...
Read more >Indexes - Full-Stack Firebase
Indexes are required in Cloud Firestore whenever you want to use two where-clauses in a single query. ... This query would require indexes...
Read more >Firebase deploy functions fails - Atlassian Community
rules already up to date, skipping upload... ✓ firestore: deployed indexes in firestore.indexes.json successfully ✓ functions: functions ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same problem. is there a fix for this?
Even we see this error. I deleted the existing indexes but still its throwing the error saying “index already exists”. But the new indexes doesn’t have any duplicates (I delete the indexes before submitting the indexes if any).
It would be great if Firestore just ignores the duplicate index and proceed with the operation.