-
Notifications
You must be signed in to change notification settings - Fork 988
Open
Labels
Description
[REQUIRED] Describe your environment
- Operating System version: Windows 10
- Firebase SDK version: 9.6.2
- rules-unit-test package version: 2.0.1
- Firebase Product: firestore
[REQUIRED] Describe the problem
When using the rules-unit-testing package, a warning is logged whenever a rule fails even if assertFails() is present and suceeds.
Doesn't appear to cause any side-effects and can be disabled by calling setLogLevel("silent") during setup but I'm assuming this is a bug since all it appears to do is cause console noise during unit test runs.
Steps to reproduce:
- Setup a test environment.
- Create a basic test that calls
assertFails()and suceeds. - Run the test.
- A warning is logged to the console that firestore denied permission.
Relevant Code:
firestore.rules
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{uid} {
allow read, write: if false;
}
}
}
it("test", async () => {
const testEnvironment = await initializeTestEnvironment({
projectId: "foo",
firestore: {
rules: fs.readFileSync("firestore.rules", "utf8"),
}
});
const randomUserDocument = testEnvironment.unauthenticatedContext().firestore().collection("users").doc("foo");
await assertFails(randomUserDocument.set({ foo: "bar" }));
});Running this test succeeds but writes the following warning to console:
@firebase/firestore: Firestore (9.6.2): Connection GRPC stream error. Code: 7 Message: 7 PERMISSION_DENIED:
false for 'create' @ L100
at Logger.defaultLogHandler [as _logHandler] (node_modules/@firebase/logger/src/logger.ts:115:57)
at Logger.Object.<anonymous>.Logger.warn (node_modules/@firebase/logger/src/logger.ts:206:21)
at logWarn (node_modules/@firebase/firestore/src/util/log.ts:69:15)
at ClientDuplexStreamImpl.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:252:9)
at Object.onReceiveStatus (node_modules/@firebase/firestore/node_modules/@grpc/grpc-js/src/client.ts:673:18)
at Object.onReceiveStatus (node_modules/@firebase/firestore/node_modules/@grpc/grpc-js/src/client-interceptors.ts:424:48)
edenhermelin, KrisTheCanadian, Shota05, an0malous, fzuellich and 18 more