6
votes

I'm trying to use the new Rules Simulator Tool provided by firebase, however I'm having problems getting it to work

When setting the path like this in the simulator panel

/users/Gd9jd3jd8sSixxx38djSs

And then selecting the authentication options and inputting the uid of the authorised user as the same string Gd9jd3jd8sSixxx38djSs. I'm getting the following error when using this firestore rule

match /users/{user}{
     allow read: if request.auth.uid == resource.id
}

"Error: simulator.rules line [4], column [41]. Property id is undefined on object. "

This document does exist inside my firestore database and is in the correct path specified.

Anyone have any ideas? Thanks

1

1 Answers

10
votes

It sounds like you just want to use the user placeholder you defined:

 allow read: if request.auth.uid == user