These are my security rules for Cloud Firestore:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Feedback/{feedback} {
allow read: if resource.data.uid == request.auth.uid;
}
}
}
It appears that I have a weird bug. When I try to access the documents in the "Feedback" collection, I get with my client a "permissioned denied" error. Using the Firestore Security Rules Playground, I get "Firestore Security Rules: Error running simulation –An unknown error occurred". I don’t see where the issue with the security rules is.
I don’t see any logs in my browser console. Already disabled uBlock Origin.
If I only use allow read: if request.auth.uid != null
it works. However, I do something with resouce.data
it throws an unknown error.
I already had a look into Error running simulation — An unknown error occurred. However, there is no solution to the problem.
2
Answers
I think it has something to do with default database being null. It says "/databases/null/documents" under "Rules Playground" title.
That’s because the resource.data.uid is null.
I’m going through the same but instead getting the error "The path … is improperly formatted. Paths should start with "/databases/$(database)/documents/".
I think @umd is right, we are not pointing to the db correctly, but have no idea how to change that null in the Location.