firebase - Firestore 规则覆盖率报告 - 从未评估过的请求表达式

标签 firebase google-cloud-firestore firebase-security

最近我一直在为我的新应用程序使用 firebase。由于您可以在 firestore 上定义自己的规则,因此我想尝试一下。

为了测试这些规则,我正在运行 firestore 模拟器。当我尝试授权某个测试用户时,我总是收到超时错误。想自己解决这个错误,我做了一些研究。

我发现可以看到“Firestore Rule Coverage Report”,在里面我看到了这个:

Error message of Firestore Rule Coverage Report

但是因为我是 firestore 的新手,所以我不知道这是什么,而且经过一些谷歌搜索后我没有找到如何解决这个问题。

最佳答案

Firestore 文档有点困惑。他们声明 URL 应该是:
http://localhost:8080/emulator/v1/projects/<database_name>:ruleCoverage.html
然而,他们没有解释什么<database_name>应该替换为您的 project_id .是的...阅读 URL 一些可能的事情是显而易见的,但实际上是应该使其显而易见的参数名称。另外,在 Firestore 中,数据库既不创建也不按名称访问。

解决方案:
<database_name>应该替换为您的 project_id (该值在文件 .firebasercgoogle-services.json 中可用

所以,如果您的 project_idmy-amazing-app ,您的 rulesCoverage 网址将是:http://localhost:8080/emulator/v1/projects/my-amazing-app:ruleCoverage.html

关于firebase - Firestore 规则覆盖率报告 - 从未评估过的请求表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59235690/

相关文章:

firebase - 无需邮箱密码即可登录 flutter

database - 选择 Firestore 集合中的所有其他文档

schema - 如何在 Firestore 中对可选属性进行类型检查

java - 需要有关 NoSuchMethodError : com. google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor 的帮助;在 IntelliJ 中

javascript - Firebase - 如何限制经过身份验证的用户对某些路径的访问?

json - firestore授权规则: for google signed in client

firebase - 如何在没有其他Google库的情况下安装Firebase Analytics Pod?

node.js - 本地 Firebase 服务器 Node 抛出 "Firebase.goOffline is not a function"

node.js - 如何创建通过 Firebase Cloud Functions 托管的 Node.js 代理服务器?

flutter - 如何使用 flutter bloc 通过使用 firestore 的依赖注入(inject)来处理错误 `The getter was called on null`