개발
[Firestore] snapshot permission error
yoosmg
2023. 2. 20. 21:44
Error code
@firebase/firestore: Firestore (9.17.1): Uncaught Error in snapshot listener: FirebaseError: \[code=permission-denied\]: Missing or insufficient permissions.
Solution
Cloud Firestore내 Rules의 config를 다음과 같이 변경한다.
(상황에 맞게 택1)
// 1. for Test mode
// Allow read/write access to all users under any conditions
// Warning: **NEVER** use this rule set in production; it allows
// anyone to overwrite your entire database.
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
// 2. for Auth required mode
// Allow read/write access on all documents to any user signed in to the application
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}