Hi there,
This #2979 pull request fixed one part of the problem mentioned in #2965 where the default instance in hosting is different from the default instance in firebase-admin and both of them now reference the same instance which is project-id-default-rtdb.
However, the rules in database.rule.json are still being applied to project-id instead of project-id-default-rtdb, and I don't know how to change that manually.
[REQUIRED] Environment info
firebase-tools: 9.3.0
Platform: Windows
[REQUIRED] Test case
functions/index.js
const admin = require("firebase-admin");
// After #2979, The following line will uses `http://localhost:9000?ns=project-id-default-rtdb`
admin.initializeApp();
admin.database().ref('test').set(1);
database.rules.json
{
"rules": {
"test":{
".read": true
},
".read": false,
".write": false
}
}
[REQUIRED] Steps to reproduce
- Run the command:
curl localhost:9000/.settings/rules.json?ns=project-id-default-rtdb -H "Authorization: Bearer owner"
- The output is:
{
"rules": {
".read": true,
".write": true
}
}
- Run the command:
curl localhost:9000/.settings/rules.json?ns=project-id -H "Authorization: Bearer owner"
- The output is:
{
"rules": {
"test":{
".read": true
},
".read": false,
".write": false
}
}
[REQUIRED] Expected behavior
Since project-id-default-rtdb is now the default instance, the database.rules.json should also be applied to project-id-default-rtdb instance instead of project-id instance.
[REQUIRED] Actual behavior
Now, database.rules.json is applied to project-id.
Hi there,
This #2979 pull request fixed one part of the problem mentioned in #2965 where the default instance in hosting is different from the default instance in firebase-admin and both of them now reference the same instance which is
project-id-default-rtdb.However, the rules in
database.rule.jsonare still being applied toproject-idinstead ofproject-id-default-rtdb, and I don't know how to change that manually.[REQUIRED] Environment info
firebase-tools: 9.3.0
Platform: Windows
[REQUIRED] Test case
functions/index.js
database.rules.json
{ "rules": { "test":{ ".read": true }, ".read": false, ".write": false } }[REQUIRED] Steps to reproduce
curl localhost:9000/.settings/rules.json?ns=project-id-default-rtdb -H "Authorization: Bearer owner"{ "rules": { ".read": true, ".write": true } }curl localhost:9000/.settings/rules.json?ns=project-id -H "Authorization: Bearer owner"{ "rules": { "test":{ ".read": true }, ".read": false, ".write": false } }[REQUIRED] Expected behavior
Since
project-id-default-rtdbis now the default instance, thedatabase.rules.jsonshould also be applied toproject-id-default-rtdbinstance instead ofproject-idinstance.[REQUIRED] Actual behavior
Now,
database.rules.jsonis applied toproject-id.