Home > Enterprise >  Firebase storage returning 412 error even after enabling storage API
Firebase storage returning 412 error even after enabling storage API

Time:09-28

We have already used firebase storage for storing the images and files in our application. Recently our files seem to bee not loading in the application and once cross-checking I found the following error.

{
  "error": {
    "code": 412,
    "message": "A required service account is missing necessary permissions. Please resolve by visiting the Storage page of the Firebase Console and re-linking your Firebase bucket or see this FAQ for more info: https://firebase.google.com/support/faq#storage-accounts"
  }
}

After further investigation, I found a solution in the below-related FAQ. https://firebase.google.com/support/faq/index#storage-accounts

As per the documentation, I have created a new service account with the I am admin role as Cloud Storage for Firebase Service Agent. It created a service account called service account name service-PROJECT_NUMBER@PROJECT_id.iam.gserviceaccount.com. Also, I have enabled the IAM admin policies for managing services. But still but storage URL is not loading.

Do I need to add any more changes to storage permissions? How can I use the existing storage bucket data with the new updates?

CodePudding user response:

I just fixed this for my self.

  1. Create a bucket in Cloud Storage
  2. Get your projectname and bucket name
  3. Go here: https://firebase.google.com/docs/reference/rest/storage/rest/v1beta/projects.buckets/addFirebase
  4. Press Try IT
  5. Fill in your projectname en bucket name. Press Execute é voila!

See my screenshot here

CodePudding user response:

As mentioned in this github.

On the IAM page with the project owner role you will have an option to Grant Access. add this service account. service-project [email protected] as a principle, Cloud Storage for Firebase Service Agent as role.

If you are having trouble adding the service account ([email protected]) to the project, it's possible that Cloud Storage for Firebase has not created it yet.

Try using the AddFirebase API to relink a bucket to your project and try again: You can refer to this

  • Related