This is my error: Error running simulation — Error: simulator.rules line [10], column [13]. Function not found error: Name: [get].; Error: Invalid argument provided to call. Function: [get], Argument: ["||invalid_argument||"]
When i run this i have used all the resources i can find on the web and found nothing that will work (the allow read works and create does when i just use isSignedIn() ) ... little help please.
service cloud.firestore {
match /databases/{database}/documents{
match /users/{documents} {
function isSignedIn() {
return request.auth != null;
}
function getRole(admin){
return get(/databases/$(database)/documents/users.[request.auth.uid]).data.admin;
}
allow read: if true;
allow write: if getRole(admin) == true;
}
}
}
Here is my db
You need to check that user authentificated before trying to get role of user in getRole function. Exception occurs because request.auth.uid is null. Also check that users.[request.auth.uid] is valid path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With