Firestore rules debug(...) function not working

Viewed 116

I have a Firebase emulator set up on my local machine, and I've connected JS client and admin SDKs to test the security rules. Reading/writing data seems to be working properly, and requests are allowed/denied in accordance with my local firestore.rules file. However, nothing is being added to firestore-debug.log after data is modified in Firestore, despite debug being added to the rules file. Is there any reason this function wouldn't be working?

firestore.rules (simplified for testing)

rules_version = '2'

service cloud.firestore {
    match /databases/{database}/documents {
        match /{document=**} {
            allow read;
            allow write: if debug(request.auth) != null;
        }
    }
}

firebase.json

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "emulators": {
    "auth": {
      "port": 9099
    },
    "firestore": {
      "port": 8080
    },
    "ui": {
      "enabled": true
    }
  }
}
0 Answers
Related