简体   繁体   中英

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. Every time I upload I get a console warning

" FIREBASE WARNING: update at / failed: permission_denied "

and

" firebase.js:478 Uncaught (in promise) Error: PERMISSION_DENIED: Permission denied "

Despite these errors, I still find the file in Firebase-storage. 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.

By changing the rules in the Firebase-Database to be:

{
    "rules": {
       ".read": "true",
       ".write": "true"
     }
 }

I am able to upload the .mp3 with no issues. 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? 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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM