I have set my Firestore permission so that anyone with my database reference will be able to read or write to my database.
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write;
}
}
}
Still I am getting
Error: 7 PERMISSION_DENIED: Missing or insufficient permissions.
While executing a simple cloud function
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();
export const sendmsg = functions.https.onRequest((request, response) => {
admin.firestore().doc('message/abcd').get()
.then(writeResult => {
console.log("data: "+ writeResult.data());
const data = writeResult.data()
response.send(data)
})
.catch(error =>{
console.log(error)
response.send(500).send(error)})
});
Please help, not sure what I am doing wrong. Thanks.