VibeFix

Guide

Firestore "Missing or insufficient permissions"

Still failing on your live site? Check it free ↓

Published by Yosef Dabian, founder of VibeFix

Updated

Short answer: "Missing or insufficient permissions" means your Firestore security rules refused the request. Usually the visitor is not signed in yet, the user ID in the path does not match theirs, or a query asks for documents the rules do not allow. Fix the rule in Firestore Database, Rules, or change the query to match it.

Key takeaways

This applies to apps that use Firebase and Cloud Firestore, including apps made with AI builders.

Fixed in your code, then tested live. Did the steps and it still fails? Our AI agent finds why on your live app with a free check, usually in under 10 minutes, then can fix it in your code.

Free. No account needed. It usually takes under 10 minutes.

Want it fixed? For Lovable apps or code on GitHub, our AI agent fixes it in your code for $29 and tests your live app again. If we can't complete your re-check, you get your money back.

Why does Firestore say "Missing or insufficient permissions"?

Every request to Firestore from a web or mobile app is checked against your security rules first. If the rules deny any document in the request, the whole request fails.

What causes "Missing or insufficient permissions" in Firestore?

The causes on this page are rules that only allow signed-in users, a user ID that does not match the path, no rule covering the path, one denied document in a multi-document request, and rule changes that have not taken effect yet.

How to fix "Missing or insufficient permissions"

  1. Open the Firebase console, then Firestore Database, then the Rules tab, and find the match block for the path in the error.
  2. For data each user owns, a rule like this allows only the owner:
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
  }
}
  1. Make the app read the same path the rule allows, for example doc(db, "users", auth.currentUser.uid), and run the query only after sign-in has finished (inside onAuthStateChanged), not on page load.
  2. For queries, add the same condition to the query that the rule checks, such as where("ownerId", "==", auth.currentUser.uid). Firebase says "security rules are not filters": a query that could return a document the user may not read is refused as a whole.
  3. When creating or updating, check new values with request.resource.data (the incoming document) and existing values with resource.data (the stored one).
  4. Test the rule in the Rules Playground on the Rules tab, with the same signed-in user and path, before publishing.
  5. Never "fix" it with allow read, write: if true;. That opens your data to anyone.

Source: Firebase: Get started with Cloud Firestore Security Rules; Firebase: Securely query data.

Why does Firestore work for me but refuse my customers?

You're signed in, your customers aren't. You test signed in as the owner, who the rules happen to allow. A different user, or a signed-out visitor, is judged by the same rules and may be refused.

How do I check it is fixed?

  1. Try the same action as a signed-out visitor and as a different signed-in user, not only as the owner.
  2. Check that the rules cover the path the app reads or writes, and that the signed-in user's ID matches that path.
  3. If you changed the rules recently, allow time for them to take effect: up to a minute for new queries and up to ten minutes for active listeners.
  4. Check that the page, the save or the console no longer shows "Missing or insufficient permissions".

Related: Who can fix my AI-built app? · App fix price · Data won't save: "new row violates row-level security policy" · Users can see other users' data in my Lovable app · My builder says the app is tested, but my customers hit problems

VibeFix is independent. Lovable, Bolt, Replit, Base44, v0, Supabase, Firebase, Stripe and Vercel are trademarks of their owners.

Want it fixed for you? For any app whose code is on GitHub, whichever tool built it, VibeFix's AI agent can find the cause of this error, fix it in your code and re-check your live app. Start with a free check: https://vibe-fixer.com

Still seeing this error? Get it fixed, starting with a free check ↑

How this guide was made: Written with AI assistance and checked against the sources linked on this page.

More guides · Videos · Use VibeFix in Claude Code · Shopify store accessibility · About · Your privacy choices