Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing Firestore rules: An unknown error occurred

On a newly created project, I cannot publish any changes to the Firebase rules. Even simple changes like adding a newline to the end of the file or adding a space.

enter image description here

I feel like this may be a bug in Firestore but thought I'd ask here first...

Error saving rules –An unknown error occurred

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if false; 
    }
  }
}
like image 344
Matt Wlazlo Avatar asked Jan 30 '26 18:01

Matt Wlazlo


2 Answers

I found that the Allow CORS: Access-Control-Allow-origin Chrome extension was the cause of this error for me. Disabling the extension fixed the error.

like image 185
Trystan Rivers Avatar answered Feb 03 '26 06:02

Trystan Rivers


Install Firebase CLI in your command prompt, login in the firebase CLI, then open the .rules file with your editor(vscode, atom) and replace it with :

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

then deploy to firebase with from your command prompt with this command

firebase deploy --only firestore:rules
like image 33
Meyer Frenchel Avatar answered Feb 03 '26 06:02

Meyer Frenchel