Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Firestore requests are erroring out with status: FirebaseError: Missing or insufficient permissions.

My Firestore read requests are getting errored out. I believe that some sort of incorrect blacklisting has happened.

Environment: development

Purpose: To get a list of all documents  in my Firestore collection named "auth"

Firestore rules:

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

Code:

let docRef = doc(db, "auth", newUserEmail.value);
let docSnap;
try {
docSnap = await getDoc(docRef);
} catch(error) {
console.log("error: ", error);
}
 
Not sure how to go about troubleshooting as Firestore has no logging system visible to developers and there are no flags on my web console.
Solved Solved
1 7 7,327
1 ACCEPTED SOLUTION

Based on inputs from the community, I realized that my rules were not permitting requests from unauthenticated users in the new login/registration pages which was exactly where the issue occurred.

I've updated my rules to,

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

View solution in original post