-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
[REQUIRED] Environment info
firebase-tools: 14.22.0
Platform: macOS (reproducible across platforms)
Node Version: v22.20.0
[REQUIRED] Test case
Create a minimal firestore.indexes.json with a vector index:
{
"indexes": [
{
"collectionGroup": "myVectorCollection",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "embedding",
"vectorConfig": {
"dimension": 768,
"flat": {}
}
}
],
"density": "SPARSE_ALL"
}
],
"fieldOverrides": []
}[REQUIRED] Steps to reproduce
1. Create the vector index in production using EITHER method:
Option A: Deploy from local firestore.indexes.json:
firebase deploy --only firestore:(default):indexes --project my-projectOption B: Create via gcloud:
gcloud firestore indexes composite create \
--collection-group=myVectorCollection \
--query-scope=COLLECTION \
--field-config field-path=embedding,vector-config='{"dimension":"768","flat":{}}' \
--database="(default)" \
--project=my-project✅ Result: Index is created successfully in production.
2. Pull the indexes from Firebase to see what was actually stored:
firebase firestore:indexes --project my-projectFirebase returns the index WITH an auto-generated __name__ field:
{
"collectionGroup": "myVectorCollection",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "__name__",
"order": "ASCENDING"
},
{
"fieldPath": "embedding",
"vectorConfig": {
"dimension": 768,
"flat": {}
}
}
]
}3. Deploy again (with or without updating local file to match what Firebase returned):
firebase deploy --only firestore:(default):indexes --project my-project4. The CLI detects a mismatch and prompts:
i firestore: The following indexes are defined in your project but are not present in your firestore indexes file:
(myVectorCollection) -- (embedding,VECTOR<768>) -- Density:SPARSE_ALL
? Would you like to delete these indexes? Selecting no will continue the rest of the deployment.
[REQUIRED] Expected behavior
The second deployment should recognize the index is already in sync and not prompt for deletion
[REQUIRED] Actual behavior
The deployment fails with:
Error: Request to https://firestore.googleapis.com/v1/projects/my-project/databases/(default)/collectionGroups/myVectorCollection/indexes had HTTP Error: 400, No valid order or array config provided: field_path: "__name__"
Root cause:
As shown in step 2, Firebase automatically adds a __name__ field to all vector indexes. This creates an impossible situation:
- Firebase CLI exports vector indexes with
__name__field - Firebase API rejects vector indexes with
__name__field when deploying/deleting - The CLI cannot reconcile the difference between local and remote definitions
Impact:
- Vector indexes cannot be deployed consistently - first deployment works, subsequent ones fail
- Cannot manage vector indexes declaratively via
firestore.indexes.json - CI/CD pipelines break when encountering the deletion prompt
- Workaround requires excluding vector indexes from version control and managing them manually