firebase-tools
firebase-tools copied to clipboard
Unsupported value type VECTOR using `affectedKeys` and `VectorValue`
[REQUIRED] Environment info
firebase-tools: 13.11.2
Platform: Windows
[REQUIRED] Test case
Here's a test case that demonstrates the issue:
- Firestore Document: Create a Firestore document with a
VectorValuefield:
{
"name": "My Document",
"embeddingVector": [1.0, 2.0, 3.0] // Example vector
}
- Security Rules: Implement rules that allow updates only to the
namefield, use affectedKeys():
function editingOnlyAllowedFields(allowedFields) {
let editedKeys = request.resource.data.diff(resource.data).affectedKeys();
return editedKeys.hasOnly(allowedFields);
}
allow update: if editingOnlyAllowedFields(['name']);
[REQUIRED] Steps to reproduce
Update the Document: Attempt to update the document, changing the name field:
{
"name": "My Document Updated"
}
[REQUIRED] Expected behavior
The expected behavior is for the rules to return true for update and the affectedKeys function to work with the VectorValue field.
[REQUIRED] Actual behavior
FirebaseError: PERMISSION_DENIED:
evaluation error at L193:30 for 'create' @ L193, evaluation error at L189:30 for 'update' @ L189, Unsupported value type VECTOR for 'update' @ L189