Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud Firestore import: PERMISSION_DENIED

I am trying to import a bucket containing a Firestore database export into antoher Firebase project. I have been following this guide on how to do this.

When running the gcloud firestore import, I run into the following issue:

ERROR: (gcloud.firestore.import) PERMISSION_DENIED: Service account does not have access to Google Cloud Storage file: /bucket/EXPORT_PREFIX.overall_export_metadata. See https://cloud.google.com/datastore/docs/export-import-entities#permissions for a list of permissions needed. Error details: [email protected] does not have storage.buckets.get access to the Google Cloud Storage bucket.

I did however use the following command to grant access to the bucket:

gsutil iam ch serviceAccount:[email protected]:admin gs://bucket_name

This did not give me any error whatsoever, so I assume it ran as expected. I triple checked and believe I was working in the correct projects while using these commands.

I think that perhaps the import command is ran with another service account than [email protected]:admin, but am unsure about this or on how to ensure the correct service account is being used.

Any help on resolving this would be highly appreciated! :)

like image 841
Bram Vanbilsen Avatar asked Oct 15 '25 06:10

Bram Vanbilsen


1 Answers

The error message appears to include the Service Account in question:

Error details:
[email protected]
does not have storage.buckets.get access to the Google Cloud Storage bucket.

I think you need to:

gsutil iam ch \
serviceAccount:[service-XXX]@gcp-sa-firestore.iam.gserviceaccount.com:objectViewer \
gs://[bucket-name]

Replacing [service-XXX] and [bucket-name]

like image 66
DazWilkin Avatar answered Oct 17 '25 22:10

DazWilkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!