Firebase存储安全规则400错误问题"权限被拒绝.无法访问存储桶xxxxx - ****.appspot.com"

Gen*_*sco 7 http-status-code-400 firebase-security firebase-storage

当我试图上传照片时,我的反应项目中我的firebase存储上传400错误导致消息错误消息错误...一切正常工作并成功上传图片,但现在它停止上传照片,发出以下错误,我不知道问题出在哪里......

提示检查的链接

POST https://firebasestorage.googleapis.com/v0/b/xxxxx-****.appspot.com/o?name=usertemp%2F0rdrGK4MRDRptAMCc3mHDveytJv1%2F0rdrGK4MRDRptAMCc3mHDveytJv1.jpg 400 ()
Run Code Online (Sandbox Code Playgroud)

这是链接响应的错误

{
  "error": {
    "code": 400,
    "message": "Permission denied. Could not access bucket xxxxx-****.appspot.com. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources."
  }
Run Code Online (Sandbox Code Playgroud)

这是我的安全

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth!=null;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我仍然试图改变match/b/xxxxx-****.appspot.com/o与仍然没有成功

gob*_*lin 15

这是由于缺少权限.你需要检查一下你是否有

firebase-storage@system.gserviceaccount.com

作为具有"Storage Admin"角色的成员.如果您没有,请添加它.这将解决问题.

以下是有关如何检查和添加权限的步骤.

  • 转到云控制台
  • 导航到存储
  • 选择您的存储桶,然后单击show info面板.

如果需要,您还可以在IAM和管理员中添加缺少的权限.

  • 知道为什么这个工作6个月并突然导致这个错误? (5认同)
  • @GünterZöchbauer我也不知道.我认为最好问一下firebase的支持.我刚刚在他们的状态仪表板中看到了这个https://status.firebase.google.com/incident/Storage/18003 (2认同)
  • 似乎他们改变了他们的规则..但是在没有通知开发人员之前通知他们的项目上的那种类型的错误太糟糕了,但是感谢Goblin在我的生活中努力在2天内对抗这个错误 (2认同)

eli*_*eli 5

当您在创建特定于文件上传的Firebase 存储之前尝试上传图像时,会发生此错误。

无法访问存储桶 xxxxx-****.appspot.com。请访问 Firebase 控制台中的存储选项卡,为您的存储桶启用 Firebase 存储,并确保您有足够的权限来正确配置资源

这就是您面临消息错误的Please Enable Firebase Storage for your bucket原因,因为 Firebase 存储充当存储桶媒体上传的默认位置。

{
  "error": {
    "code": 400,
    "message": "Permission denied. Could not access bucket xxxxx-****.appspot.com. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources."
  }
Run Code Online (Sandbox Code Playgroud)

该怎么办?

只需转到您的项目Firebase 控制台 >> 存储 >>并点击开始 在此处输入图片说明