Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore Rules Simulator - Resource undefined

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

like image 303
ptgodz Avatar asked Aug 16 '18 09:08

ptgodz


1 Answers

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

 allow read: if request.auth.uid == user
like image 162
Doug Stevenson Avatar answered Nov 10 '22 21:11

Doug Stevenson