Guide
Firestore "Missing or insufficient permissions"
Still failing on your live site? Check it free ↓
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
Missing or insufficient permissionsmeans 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.
- If the rules deny any document in the request, the whole request fails.
- After changing rules, allow up to a minute for new queries and up to ten minutes for active listeners.
This applies to apps that use Firebase and Cloud Firestore, including apps made with AI builders.
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.
- The rules only allow signed-in users, and the visitor is signed out.
- The rules tie data to the user's ID, and the signed-in user's ID does not match the path the app reads or writes.
- No rule covers the path the app uses.
- One document in a multi-document request is not allowed, so the whole request is denied.
- The rules were changed recently and have not taken effect yet; Firebase says it can take up to a minute for new queries and up to ten minutes for active listeners.
How to fix "Missing or insufficient permissions"
- Open the Firebase console, then Firestore Database, then the Rules tab, and find the
matchblock for the path in the error. - 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;
}
}
}
- 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 (insideonAuthStateChanged), not on page load. - 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. - When creating or updating, check new values with
request.resource.data(the incoming document) and existing values withresource.data(the stored one). - Test the rule in the Rules Playground on the Rules tab, with the same signed-in user and path, before publishing.
- 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?
- Try the same action as a signed-out visitor and as a different signed-in user, not only as the owner.
- Check that the rules cover the path the app reads or writes, and that the signed-in user's ID matches that path.
- 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.
- 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