Hello,
I'm having some problems with the firestore security rules, in web I can only write but not read, and in nodejs I can do both.
My security rules are:
match /items/{item} {
// Applies to writes to nonexistent documents
allow create: if true;
// Applies to writes to existing documents
allow update: if incomingData().user == existingData(). user;
// Applies to delete operations
allow delete: if false;
allow read: if incomingData(). user == existingData(). user;
}
In nodejs with firebase-admin: v5.12.0 this works fine:
admin.firestore().collection('items').where('user', '==', userId).get().then(snapshot => {...
In web, the same gives me "Error getting documents: Error: Missing or insufficient permissions.":
firebase.firestore().collection('items').where('user', '==', userId).get().then(function(querySnapshot) {...
In web I am using v4.10.1 and also tried v4.6.2.
Also, in web I can write documents without any problem:
firebase.firestore().collection('items).doc(userId+"_"+itemId).set(data)
All values of userId are ok, I'm really stuck, does anyone know what can be happening?
Thanks.