我的 Firestore 读取请求出现错误。我相信已经发生了某种不正确的黑名单。
环境:发展
用途:在我的 Firestore 集合中查找名为“auth”的文档
Firestore 规则:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
代码:
let docRef = doc(db, "auth", newUserEmail.value);
let docSnap;
try {
docSnap = await getDoc(docRef);
} catch(error) {
console.log("error: ", error);
}
错误信息: 错误:FirebaseError:权限缺失或不足。
不确定如何进行故障排除,因为 Firestore 没有开发人员可见的日志系统,并且我的 Web 控制台上没有标志。
这可能是因为
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.time < timestamp.date(2023, 12, 17);
}
}
}
尝试将此作为临时解决方案,当添加到生产中时可能需要更新它
希望它对你有用