W/Firestore( 7187): (21.3.0) [Firestore]: Listen for Query(products order by __name__) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null} W code example

Example: firestore missing or insufficient permissions

//"firestore missing or insufficient permissions" could be because of 
//insufficient read and/or write permissions

//Let's say that a user is not logged in but needs to read landmarks data,
//we should then create a rule to allow the read operation
service cloud.firestore {
  match /databases/{database}/documents {
    // Explicitly allow users to read the collection
    // even if they are not authenticated
    match /landmarks/{landmark} {
    allow read;
    }

    match /cities/{city} {
      allow read, write: if <condition>;
    }
  }
}
//More info on structuring security rules:
//https://firebase.google.com/docs/firestore/security/rules-structure

Tags:

Misc Example