assertFails() of @firebase/rules-unit-testing says Expected PERMISSION_DENIED but got unexpected error: FirebaseError: [code=permission-denied]: No matching allow statements when assertFails(firestore().collection('tests').doc('a').get()) in the below rules. This throws below error.
{ FirebaseError: No matching allow statements
at new FirestoreError (/Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/util/error.ts:166:5)
at fromRpcStatus (/Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/remote/serializer.ts:134:10)
at fromWatchChange (/Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/remote/serializer.ts:490:33)
at PersistentListenStream.Object.<anonymous>.PersistentListenStream.onMessage (/Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/remote/persistent_stream.ts:576:25)
at /Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/remote/persistent_stream.ts:456:21
at /Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/remote/persistent_stream.ts:509:18
at /Users/moga/workspace/clones/UhooiPicBook-Firebase/node_modules/@firebase/firestore/src/util/async_queue.ts:367:14
at process._tickCallback (internal/process/next_tick.js:68:7)
code: 'permission-denied',
name: 'FirebaseError',
toString: [Function] }
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /tests/{monsterId} {
allow list: if true;
}
}
}
So I fix this problem at this commit. If this would be ok, I'm willing to create pr!
Relevant Code:
import*asfirebasefrom'@firebase/rules-unit-testing'constfirestore=firebase.initializeTestApp({projectId: 'sample',databaseName: 'db'}).firestore()describe('test',()=>{it('this shoud be passed but fails',async()=>{awaitfirebase.assertFails(firestore().collection('tests').doc('a').get())})})
The text was updated successfully, but these errors were encountered:
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
assertFails()
of @firebase/rules-unit-testing saysExpected PERMISSION_DENIED but got unexpected error: FirebaseError: [code=permission-denied]: No matching allow statements
whenassertFails(firestore().collection('tests').doc('a').get())
in the below rules. This throws below error.So I fix this problem at this commit. If this would be ok, I'm willing to create pr!
Relevant Code:
The text was updated successfully, but these errors were encountered: