Failed to export Firestore database - firebase

I am trying out the new export feature of the FireStore as shown on this link, and I keep getting error message:
gcloud alpha firestore export gs://backup --async
ERROR: (gcloud.alpha.firestore.export) PERMISSION_DENIED: Service account does not have access to Google Cloud Storage file: /backup. See https://cloud.google.com/datastore/docs/export-import-entities#permissions for a list of permissions needed. Error details: projectABC#appspot.gserviceaccount.com does not have storage.buckets.get access to backup.
I've run the command to add my service account as a storage.admin, and that command succeed:
gcloud projects add-iam-policy-binding projectABC --member='serviceAccount: projectABC#appspot.gserviceaccount.com' --role='roles/storage.admin'
Could someone help?

You can't select an arbitrary bucket name for your backup. You're using "gs://backup". Instead, you need to use the url for an actual bucket that you've created an you fully control.

Give storage admin access to IAM role

Related

gcp giving it roles iam roles to configure the policiy

so what every i am doing in the gcp giving it roles iam roles to configure the policies , i am not able to do to my firebase project. i am able to log into it using my terminal with firebase login and then then firebare init is there and i put the function initilaize but it says i don't have permission to do that i need to give it permission so i open the file
/iam-admin/iam?folder=&organizationId=&project=clone-6de06 because this is my firebase project but i dont' have access to it in the gcp so i am not able to change the permission to change the policy or
need to run the role command
gcloud projects add-iam-policy-binding ourcafe-mucqxq
--member=serviceAccount:service-1044193269753#gcf-admin-robot.iam.gserviceaccount.com
--role=roles/cloudfunctions.serviceAgent as that says it will take care of following error: Deployment of your Cloud Function failed:
Missing necessary permission resourcemanager.projects.getIamPolicy for
service-1044193269753#gcf-admin-robot.iam.gserviceaccount.com on
resource projects/ourcafe-mucqxq. Please grant
service-1044193269753#gcf-admin-robot.iam.gserviceaccount.com the
Cloud Functions Service Agent
any help will be appreciated thank for the help.
Did you try to log in to firebase with a proper account?
If you're not sure that your account with proper permission, you can go to Firebase project >> Project settings >> Users and permission to check that your account is on the list with the right permission.
Also, you can see all of the accounts on the IAM of GCP console.

source bucket is not visible in Firebase Firestore import web tool even after giving required permission

I'm following the official docs on how to export and import firebase firestore data between 2 projects.
I'm able to export firestore data to a bucket. https://console.cloud.google.com/firestore/export
But I don't see that bucket when I try to import in a different firebase project. https://console.cloud.google.com/firestore/import
I gave Storage Admin permission to the destination service account i.e. dest-proj#appspot.gserviceaccount.com and both projects and this bucket is stored in the same multi-region (us-centeral)
I'm aware of the other way to import-export using gcloud shell but why this method is not working?
The console only browse buckets that exist inside your current project. If data is coming from an outside bucket, you can simply type its entire file path in the Filename field as shown on the image below.
It will succeed if the service account running the import have the right IAM permission on the separate source bucket.

error creating storage bucket using gsutil

I do not have billing associated with my google account but when I create a new firebase project I can create a default bucket just by going to storage section on console and pressing get start (check the screenshot)
but when I try to create this default gsutil
gsutil mb -p project-id gs://project-id.appspot.com/
I got this error
AccessDeniedException: 403 The project to be billed is associated with an absent billing account.
is there any way to enable this default storage using gsuitl, code or command without opening the console site?
Firebase's default bucket works basically by building the storage costs into your Firebase bill. But gsutil is a GCS tool, i.e., you're attempting to use the underlying storage that Firebase uses. To do that, you need to set up billing first.
Looks like it is billing issue, first setup billing then try to create bucket.
you can use gsutil or use GCP UI to create bucket

Firestore Import database

I trying to set up a development environment from an existent project on Firebase, we are currently using Firestore as a database. I've successfully exported the Firestore data from one project to another but I can't figure out a way of importing the data, it keeps saying
ERROR: (gcloud.firestore.import) PERMISSION_DENIED: The caller does not have permission
I've tried adding the [SOURCE_PROJECT_ID]#appspot.gserviceaccount.com as a Storage admin on the bucked but got no success, also tried adding all possible permissions and accessing through the cli the services accounts.
Which permissions do I need in order to import this data?
So you have a source_project and a new dev_project, and you're trying to run gcloud firestore import for your dev_project. Some things to check:
Make sure gcloud is connected to your dev_project:
gcloud config set project DEV_PROJECT_ID
From the error, it sounds like the account you're using with gcloud doesn't have permission to run gcloud firestore import for your dev_project. Make sure your user account is a project owner or has the datastore.owner role for your dev_project.
For the bucket permissions, it's the [DEV_PROJECT_ID]#appspot.gserviceaccount.com service account that needs access to the bucket with the data files.
Also see docs for moving Firestore data between projects.

Error: HTTP error: 400, Project 'my_project' is not a Firestore enabled project

While I run the command firebase deploy I get this error:
Error: HTTP Error: 400, Project 'my_project' is not a Firestore enabled project.
Are you trying to use Cloud Firestore?
If so, visit the database section of the console and initialize Cloud Firestore
If not, remove the firestore.rules file locally
I figured it out myself. It was just an ignorance while using the firebase console. I just had to enable the firestore beta from the console itself, under Database.
If you’re not using Cloud Firestore, comment firestore in firebase.json
I had the same problem. The solution is this: Go to Firebase console and login there [Firebase console]. Here you will see your Recent projects. Go to your project e.g. “stepintothepresent” and then go to database at left side panel, then choose cloud firestore and then I selected the 2nd option.
After that I run firebase deploy from command prompt and the result is this
You can enable the REST APIs using below URL:
https://console.cloud.google.com/apis/library?project=
selected Cloud Firestore while initial firebase setup?
Just go to console and enable Cloud Firestore.
When prompted for once you can select test mode to start off and later change it to private.
I had to create a DB environment and it worked fine after that. I'm using the realtime DB, not Cloud storage so it shouldn't have stopped it, anyway, its fixed.
someone with another answer please.
Are you trying to use Cloud Firestore?
If so, visit the database section of the console and initialize Cloud Firestore
* Can you post the url please?
If not, remove the firestore.rules file locally
*Error: Error reading rules file firestore.rules

Resources