PERMISSION_DENIED Firestore CloudFunction TypeScript [英] PERMISSION_DENIED Firestore CloudFunction TypeScript

查看:77
本文介绍了PERMISSION_DENIED Firestore CloudFunction TypeScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了我的Firestore权限,以便具有我的数据库引用的任何人都可以读取或写入我的数据库.

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;
   }
  }
}

我还是得到

Error: 7 PERMISSION_DENIED: Missing or insufficient permissions.

在执行简单的云功能时

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.

推荐答案

使用以前运行过某些Cloud Functions的旧项目也存在相同的问题.创建一个新项目,然后再次部署,它就可以正常工作.

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.

这篇关于PERMISSION_DENIED Firestore CloudFunction TypeScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆