2

In my project I have the default bucket and an extra bucket.

When trying to add a new bucket everything seems ok, but if I try to access it from the Firebase Console is gone. It is not listed.

However if I go the the Google Cloud Console the bucket is there, but I can not access it from my app nor from the Firebase console.

If I try to access the bucket from my application I get this error:

Caused by: java.io.IOException: { "error": { "code": 400,
"message": "Permission denied. Could not access bucket ubvplayersdata. 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.", "status": "ACCESS_BUCKET" }}

I'm using rules version 2 in order to list buckets and on the Blaze plan.

The gs for the bucket: gs://ubvplayersdata

What am I missing?

EDIT: The link in this answer made me realize that there was no firebase-storage@system.gserviceaccount.com with Storage Admin role in the Google Cloud Console, but even after setting them manually, nor trying to import the bucket from Google Console to Firebase Console, still doesn't work.

UPDATE: After contacting Firebase Support they told me that after a fix on their backend the issue was indeed fixed.

Guanaco Devs
  • 1,822
  • 2
  • 21
  • 38

2 Answers2

2

You will need to import the bucket created in the Cloud console for use with Firebase, otherwise it will not show in the Firebase console, and you won't be able to access it from mobile clients.

In the Firebase Storage object browser (Firebase console):

  1. Click the overflow menu (three vertical dots) in the upper right
  2. Change the radio button to "Import existing Google Cloud Storage buckets"
  3. Select the other bucket.
  4. Accept the default security rules (you will want to change these later)
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I do not create the bucket in Cloud Console, I create the bucket in Firebase Console. Just right after creation, it is there, once I go away from the page or click on the bucket, it is no longer listed, nor accessible, If I enter the path in the browser address bar, seems like it is there, empty, but the rules are not. – Guanaco Devs Aug 23 '19 at 23:17
  • 1
    The Firebase console should list all the buckets added via the Firebase console. If this is not the case, contact Firebase support directly. https://support.google.com/firebase/contact/support – Doug Stevenson Aug 23 '19 at 23:20
1

I'm not sure about the console, but from the app try to specify the name of the new buckets other than the default one:

// Get a non-default Storage bucket FirebaseStorage storage = FirebaseStorage.getInstance("gs://my-custom-bucket");StorageActivity.java

here you can read more about this

Make sure you set the security rules for the new bucket! Here a link that might help:

add the missing permission in the IAM & Admin

File Path structure

TuGordoBello
  • 4,350
  • 9
  • 52
  • 78
aldobaie
  • 1,387
  • 10
  • 15
  • This is not my problem, my problem is that after creation the bucket is gone, does not exist anymore, therefore if I try to upload a file or get a reference on this bucket it will fail. – Guanaco Devs Aug 23 '19 at 22:41
  • @Racu it sounds as a permission problem, doesn't it? have you allowed read and write for the new bucket? – aldobaie Aug 23 '19 at 23:03
  • The problem with the permission is the rules file is not there, in the Firebase Console, and I can not mannually edit it. When you create a new bucket it sets the rules to the default. But in my case the bucket is created, you can see it listed after creation, but once I click there it just disappear and is no longer listed although it is listed on google cloud console. – Guanaco Devs Aug 23 '19 at 23:09
  • I think it actually inherits the rules from the `default` bucket. But after creation the bucket no longer exists in Firebase Console but if I try to create a new bucket with the same name it won't allow it, as it is already there, not visible to Firebase Console but is there. – Guanaco Devs Aug 23 '19 at 23:12
  • 1
    @Racu I edited my answer with a link that describes how to fix the permissions from Google cloud console, I hope you find what you need in the link. – aldobaie Aug 23 '19 at 23:24
  • Both extra buckets I created were missing the `firebase-storage@system.gserviceaccount.com` account with the `Storage Admin` role, but after enabling it. Still no luck. That was a nice link. – Guanaco Devs Aug 23 '19 at 23:50