google-cloud-firestore - Firestore 规则模拟器 - 子集合的请求为空
问题描述
以下规则在嵌套 (**) 匹配中对“请求”产生错误:
运行模拟时出错 — 错误:simulator.rules 行 [10]、列 [30]。空值错误。
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow users to only edit their records
match /users/{userId}{
allow read, update, delete: if request.auth.uid == userId;
allow create: if request.auth.uid != null;
match /{documents=**} {
allow read, write: if request.auth.uid == userId;
}
}
}
}
失败的模拟器测试是:
GET: /users/MyUserId/items/MyItemId
这是使用“密码”身份验证,但即使将其作为“未经身份验证”运行也会产生相同的错误,就好像模拟器没有正确编译规则一样。
解决方案
进一步的故障排除表明它可以在数据库中实时工作,而不是在模拟器中。所以一定是模拟器的bug。
推荐阅读
- r - reprex 显示正确的输出,但 rstudio 控制台显示错误
- npm - 源文本中无法识别的标记
- scala - Scala:foreachPartition 将 Object 类型而不是 Iterator [Row] 传递给方法
- matplotlib - 如何绘制连接seaborn中多个小提琴分布的中位数的线?
- javascript - Seaside & jQuery UI:可排序列表不起作用?
- twitter-bootstrap - 为什么列不在 Bootstrap 5 中居中?
- azure - 天蓝色应用服务身份验证/授权不可用
- google-bigquery - 如何使用密钥访问 Bigquery
- javascript - 在角度模板中显示 html 标签,不要渲染它
- opencv - Opencv视差图失真/闪烁问题