1
votes

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
The Admin SDK isn't subject to any security rules established for Firestore (or Realtime Database, or Cloud Storage). So, hearing this is really confusing to me. Are you sure that message is generated by the function you've shown?Doug Stevenson
Yes, I am seeing it in the Functions Log tab.Debanjan Banerjee
Screenshot of the log added.Debanjan Banerjee
You might want to take this one up with Firebase support. firebase.google.com/support/contact/troubleshootingDoug Stevenson
Sent a request. Thanks for the link.Debanjan Banerjee

1 Answers

0
votes

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.