Well, never mind, I already managed to fix it.
For those who have this problem, depending on whether or not you know how to code, you should do the following:
If you know how to code:
Modify the Firebase permissions so that any user has access to absolutely everything! Temporarily, of course.
If you don’t know how to code:
Ask the AI to simplify the Firebase permissions so that all users have administrator permissions or permission to modify absolutely everything.
so… next step
If you don’t know how to code:
Paste this prompt to the Firebase AI:
The issue is not in Security Rules.
The issue is that a Firestore query is being constructed with an invalid path.
You must validate the path before creating the collection reference.
Add a guard like this before creating the query:
if (!path || path.trim() === “”) return;
Or if the collection depends on authentication:
if (!user?.uid) return;
This prevents the app from trying to list the root of Firestore.
⚠️ Important
Do NOT modify Security Rules if they are already open.
The error is caused by an invalid query path, not by permission restrictions.
If you know code:
I’m not sure how to explain this, but simply put, the problem could be that the requests are being made to invalid or empty paths. Make sure to check if the path is valid before trying to access it. (? mmm this may not be exactly useful to you, but in any case I’ll leave you the explanation that chatgpt left me
🔥 Solution – Firestore “Missing or insufficient permissions” (method: list, path: /documents/)
I was receiving this error in Firebase Studio Preview:
Missing or insufficient permissions
Method: list
Path: /databases/(default)/documents/
My Firestore Security Rules were already fully open:
match /{document=**} {
allow read, write: if true;
}
So this was NOT a permissions issue.
✅ Root Cause
The error happens because the application is attempting to perform a list() operation on the root of the database:
/databases/(default)/documents/
Firestore does NOT allow listing the root of the database, even if your security rules allow full access.
This usually occurs when collection() receives:
An empty string “”
undefined
null
Or when user.uid is undefined and used in the path
Example of problematic code:
collection(db, “”)
collection(db, undefined)
collection(db, user.uid) // when user is null
It might not be the same in your case, but you can analyze it and look for similarities in your project to find the solution.
Finally, I’ll leave my Firebase permissions here in case you want to try mine and see if the problem goes away.
rules_version = ‘2’;
service cloud.firestore {
match /databases/{database}/documents {
// FULL OPENNESS FOR DEVELOPMENT:
// Allows any read or write operation for any user.
/ This solves permission problems in group queries (collectionGroup) and in the preview.
match /{document=**} {
allow read, write: if true;
}
}
}
Thanks for your time and i hope you find this helpful for you. byeee