Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
715 views
in Technique[技术] by (71.8m points)

google cloud functions - Setting correct permissions for gcloud storage firestore export

Can someone point out what I'm missing here? I have a cloud function (triggered on a schedule) which executes this piece of code:

const client = new firestore.v1.FirestoreAdminClient()
const projectId = process.env.GCP_PROJECT || process.env.GCLOUD_PROJECT
const databaseName = client.databasePath(projectId, '(default)')
return client.exportDocuments({name: databaseName, outputUriPrefix: 'gs://BUCKET-NAME', collectionIds: [] })

and fails with this in the log:

Error: 7 PERMISSION_DENIED: Service account does not have access to Google Cloud Storage file: /XXX-XXX.
Error details: [email protected] does not have storage.buckets.get access to the Google Cloud Storage bucket.

This is how the permissions on that bucket are set (and to confirm, I set this and saved it about an hour ago—I just reopened the edit box to get the image):

enter image description here

So, as far as I can tell, [email protected] should have full access to that bucket. But it claims not to have. What am I missing?

question from:https://stackoverflow.com/questions/65844168/setting-correct-permissions-for-gcloud-storage-firestore-export

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I guess it's a fairly complicated system, but it's very frustrating. The solution was to remove that permission, save it, then add it again. The internet equivalent of pressing the button harder I guess. Oh well. Posting anyway in case it helps anyone else.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...