Luke Alves
Luke Alves

Reputation: 63

Error in Firebase Permission - Unable to access bucket through firebase storage

I try to upload some file to Firebase. But the console shows me this error:

{"code": 400, "message": "Permission denied. Could not access bucket educasys-e422a.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."}

My Firebase database (Educasys) rules:

service cloud.firestore {
   match /databases/{database}/documents {
      match /{document=**} {
         allow read, write;
      }
   }
}

FireBase Image

What can I do?

Upvotes: 4

Views: 4618

Answers (2)

Krishna Pankhania
Krishna Pankhania

Reputation: 101

Check these 3 things

  1. storage rules should allow read write sample rule

  2. In your code while initializing firebase storageBucket value should be like

    firebase.initializeApp({storageBucket: 'your-project-id.appspot.com'});

  3. If want to access some other bucket from the project then get the storage instance like below

    var storage = firebase.app().storage("gs://my-custom-bucket");

source : https://firebase.google.com/docs/storage/web/start

Upvotes: 2

K.Wu
K.Wu

Reputation: 3633

I think you misunderstood something. FireStore is also database, don't get fooled by the name. It's a new database service by Firebase, it supports more features when compared to Firebase, e.g. More queries allowed, performance enhancement, etc.

You're trying to upload files to Firebase, therefore, don't go to FireStore, go to the storage option on the left panel and change the rules there:

enter image description here

Then change your rules like this:

enter image description here

Upvotes: 6

Related Questions