firebase firestore:“错误”:“权限缺失或不足。”

问题描述 投票:0回答:1

即使我已经设置了允许读取这样的数据的规则,我仍然收到此错误:

rules_version = '2';

service cloud.firestore {
    match /databases/{database}/documents {
    match /{document=**} {
        allow get, create, update, delete: if true;
    }
}

这是我获取数据的方式:

getAllByConstraint(p_field, p_constraint) {
        return new Promise( async (resolve, reject) => {
            try {
                const db = getFirestore()
                const request = query(collection(db, 'report'), 
                                where(p_field, '==', p_constraint))

                const snapshot = await getDocs(request)
                console.log("constraint" + p_constraint)

                if (!snapshot.empty) {
                    const results = snapshot.docs.map(doc => doc.data());
                    resolve(results);
                } else {
                    throw new Error(`Fetching failed. No information found.`)
                }
            } 
            catch(error) { reject(error) }
        })
    }```
node.js google-cloud-firestore
1个回答
0
投票

更新您的 Firebase 规则

rules_version = '2';

服务cloud.firestore {

match /databases/{database}/documents {
match /{document=**} {
    allow read, create, update, delete: if true;
}

}

© www.soinside.com 2019 - 2024. All rights reserved.