firebase.loadFirestoreRules() causes “Payload Error”

When I updated firebase (and some related) modules, firebase.loadFirestoreRules() method turned to causes the “Payload Error”, at a test uses “Firestore emulator”.

my code

await firebase.loadFirestoreRules({
  projectId,
  rules: fs.readFileSync('./firestore/default.rules'),
});

the error reported

Failed: Object {
 "code": 400,
 "message": "Payload isn't valid for request.",
 "status": "INVALID_ARGUMENT",
}

work around

I removed the code from my test. the rules defined in ‘default.rules’ are seems to be loaded on emulator by default.

I’m not sure, but I remember in previous version, the rule file were not loaded by default, so
I wrote above code, I think. Is there are something change and the rule turned to be loaded automatically?

Environments

  • Operating System version: macOS 10.15.5

  • Firebase SDK version: 7.16.0

  • Firebase Product: Firestore

  • the updated module settings are

"@firebase/testing": "^0.19.4" -> "^0.20.6"
"firebase-admin": "^8.12.1" -> "^8.13.0"
"firebase-functions": "^3.6.1" -> "^3.7.0"
"firebase-tools": "^8.3.0" -> "^8.5.0"
"firebase": "^7.14.4" -> "^7.16.0"
"google-gax": "not exists" -> "^2.0.0"

1 possible answer(s) on “firebase.loadFirestoreRules() causes “Payload Error”