【发布时间】: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