I am having a database in Firestore which have the number of collections for which I have defined security rules with read, create, update and delete operations.
Till Saturday noon, all the rules with given condition was allowing to read and write the data to the collections but suddenly after that in one specific collection named "locations" it giving PERMISSION DENIED exception only for creating document in the same collection but read, update and delete works.
So I changed rule for that collection like for testing as below
match /locations/{locationID} {
allow read: if true;
allow create: if true; //Condition commented...
allow update: if <condition>;
allow delete: if false;
}
and in Android Client I have coded as
database.collection("locations").add(mapData)
.addOnCompleteListener {
if (it.isSuccessful) {
//Success
} else {
//Exception
}
}
Even though, making to allow create: if true, it gives the same exception of Missing or Insufficient Permission. but when I change it to "allow write: if true" it works and document is added
When I changed collection name to test in both Rules and Client Code, it creates new document in the same collection but when I changed collection name to locationData, location and locations, it won't work.
Is this an issue in Firestore rule or What can be the solution for this?