Home > Enterprise >  Firebase popular rules not working with the updated Firebase
Firebase popular rules not working with the updated Firebase

Time:04-25

I'm trying to use the most popular/common firebase rule of

{ "rules": { ".read": true, ".write": true } }

Every time I put it in, I get the error of

"mismatched input '{' expecting {'function', 'import', 'service', 'rules_version'}"

My current rule is

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

CodePudding user response:

What you're trying to enter are security rules for the Realtime Database, but you're trying to enter them for Cloud Firestore, which is another database. While both databases are part of Firebase, they're completely separate, and the security rules for one don't apply to the other.

To fix the error, you will have to set the rules for Cloud Firestore, as shown here and here.

  • Related