[英]Can't upload to Firebase-Storage/Permission Denied
I am trying to upload .mp3 files via Firebase-storage but I am running into an issue with the permissions/rules. 我正在尝试通过Firebase存储上载.mp3文件,但是我遇到了权限/规则问题。 Every time I upload I get a console warning 每次上传时,都会收到控制台警告
" FIREBASE WARNING: update at / failed: permission_denied " “ FIREBASE警告:更新于/失败:Permission_denied ”
and 和
" firebase.js:478 Uncaught (in promise) Error: PERMISSION_DENIED: Permission denied " “ firebase.js:478未捕获(承诺)错误:PERMISSION_DENIED:权限被拒绝 ”
Despite these errors, I still find the file in Firebase-storage. 尽管有这些错误,我仍然在Firebase存储中找到该文件。 However, these errors prevent my code from running smoothly. 但是,这些错误使我的代码无法顺利运行。 I have found that changing the rules in my Firebase-Database allows me to upload with no issues. 我发现更改Firebase数据库中的规则使我可以毫无问题地进行上传。
By changing the rules in the Firebase-Database to be: 通过将Firebase-Database中的规则更改为:
{
"rules": {
".read": "true",
".write": "true"
}
}
I am able to upload the .mp3 with no issues. 我可以上传.mp3,没有问题。 Obviously for security reasons I can't have these rules always being true. 显然出于安全原因,我不能让这些规则始终为真。
My storage rules are 我的存储规则是
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
Does anyone know if there is a connection between Firebase-Storage and the Firebase-Database/rules? 有谁知道Firebase-Storage和Firebase-Database /规则之间是否存在连接? Or how to resolve my permissions errors? 或者如何解决我的权限错误?
Turns out the issue I was having was not related to the Storage. 原来我遇到的问题与存储无关。 I had not supplied a rule for part of the data I was posting to the database. 我没有为要发布到数据库的部分数据提供规则。 That is why the errors would not show up if I added a ".write": "true". 这就是为什么如果添加“ .write”:“ true”不会显示错误的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.