Search code examples
firebasegoogle-cloud-firestorefirebase-security

Monitoring, logging a Firestore rule error


I have an app in production environment with remote logging of the client side errors. I get now and then this Firebase (firestore) security rules error:

FirebaseError: Missing or insufficient permissions.

When I check on the rules console, I can see that those errors are actually reported, but I have now way to see which rule specifically has provoked the error. I have no way to trace back which part of my client side code is triggering this error.

Any suggestions to find it? Any log from the Google console where I can dive?


Solution

  • In production no details are logged anywhere about what specific part of your security rules failed.

    The two most common approaches to finding this are based on "replaying" the scenarios in your app:

    In both cases I find it easiest to use a divide and conquer approach, enabling/disabling large chunks of my rules at a time to zoom in on what check might be rejecting the operation.