Issues With Firebase Rules Configuration

Issues With Firebase Rules Configuration
typescript
Ethan Jackson

I am attempting to make a basic forum/chat site for myself as a fun project. I have been having several issues pertaining to the rules configuration for firebase.

Here is some example code that i have tried using with firebase rules:

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

I have tried several things like removing the line of code entirety, Making the syntax simpler and more. It says that the specific error is in line one of my code as it is having a parse error but I cant quite figure this out. Any help is accepted.

Here is a picture of what this error looks like in my firebase console

Thank you for your time.

Answer

Firebase has two NoSQL databases

Firebase contain two NoSQL databases: the Realtime Database and Cloud Firestore. Both of these are part of Firebase, and support server-side security rules, but they use a different API/syntax.

Wrong rules

You're pasting rules that are written in the Firestore syntax into the Firebase console for the Realtime Database, and that won't work.

Solution

You'll either have to write rules for the Realtime Database, or paste your Firestore rules into the correct panel in the Firebase console.

Related Articles