【问题标题】:Cannot deploy firebase security through CLI for asia_southeast1 database无法通过 CLI 为 asia_southeast1 数据库部署 firebase 安全性
【发布时间】:2021-11-25 13:55:14
【问题描述】:

我将数据库从 us-central1 迁移到 asia_southeast1。我想将安全规则部署到新数据库,但它不起作用。以下是我采取的步骤和结果:

(新的db叫abc-asia-db,整个数据库的url是https://abc-asia-db.asia-southeast1.firebasedatabase.app/)

firebase target:apply database main abc-asia-db

在 firebase.json 中用以下内容替换数据库脚本

"database": 
    [{"target": "main","rules": "database.rules.json"},
    {"target": "other","rules": "other.rules.json"}]

firebase deploy --only database

然后,它显示以下错误消息:

Error: Failed to get instance details for instance: abc-asia-db. See firebase-debug.log for more details.

如果我在 us-central1 中创建了新数据库,它运行良好。可以成功部署安全规则。但是,如果我在 asia_southeast1 中创建新数据库,它就不起作用了。

我使用 Mac OS,但在我的计算机中找不到 debug.log。文件夹中只有文件。

drwxr-xr-x  19 xxx  staff   608 Aug 27 13:16 ..
drwxr-xr-x  12 xxx  staff   384 Oct  5 14:39 functions
-rw-r--r--@  1 xxx  staff   644 Oct  5 15:41 database.rules.json
-rw-r--r--@  1 xxx  staff   643 Oct  5 16:28 other.rules.json
-rw-r--r--   1 xxx  staff   382 Oct  5 16:47 .firebaserc
-rw-r--r--   1 xxx  staff   467 Oct  6 11:52 firebase.json
drwxr-xr-x   9 xxx  staff   288 Oct  6 12:44 .

【问题讨论】:

  • 您对数据库的firebase.json 文件定义似乎不正确。看看这里:firebase.google.com/docs/database/usage/….
  • 你能把debug.log的内容贴出来吗?
  • 我更新了 firebase.json 作为示例,但结果相同。
  • 我用的是macos,你介意告诉我们在哪里可以得到debug.log吗?
  • 在与您执行命令的文件夹相同的文件夹中。

标签: firebase firebase-realtime-database firebase-cli


【解决方案1】:

您的firebase.json 可能格式不正确。在example 中,每个数据库只有一个规则文件。在您的示例中,我看到主数据库的重复条目。尝试使用此firebase.json 内容作为示例:

{
  "database": [
    {"target": "main", "rules": "database.rules.json"}
  ]
}

【讨论】:

  • 我更新了 firebase.json 作为示例,但结果相同。
猜你喜欢
  • 2017-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-02
  • 2016-11-11
  • 2018-02-02
  • 2020-01-22
相关资源
最近更新 更多