1

enter image description hereI 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.

1 Answers1

0

Had the same issue using an older project that had some Cloud Functions running in it before. Created a new project, deployed it again, and it worked.

Marc Bacvanski
  • 1,458
  • 4
  • 17
  • 33