firebase / firebase/firebase-js-sdk
get() in security rules is bugged
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: N/A
* Browser version: N/A
* Firebase SDK version: N/A
* Firebase Product: firestore
### [REQUIRED] Describe the problem
In firestore rules, if you `get()` a document that does not exists, the get throw an error instead of returning `null` as described in the documentation: https://firebase.google.com/docs/reference/rules/rules.firestore#.get
Note that it works fine when you use the "rules tester" in the firebase console. But it fails on prod or with the emulator.
#### Steps to reproduce:
```
match /test/{test} {
allow create: if get(/databases/$(database)/documents/doesNotExist/doesNotExist) == null;
}
```
And try to create a document.
Contributor guide
Assessment
This issue has not been assessed yet.