Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google cloud deploy error - Could not retrieve the default Google Cloud Storage bucket for [project]

Not entirely sure on the steps I need to take here. I have my rails app setup and ready to deploy on the google cloud platform the last thing to do is run gcloud preview app deploy

Problem is when I run it I get the errors

ERROR: Error Response: [403] Request had insufficient authentication scopes.
ERROR: (gcloud.preview.app.deploy) Could not retrieve the default Google Cloud Storage bucket for [project]. Please try again or use the [bucket] argument.
root@project-small-group-1-po7p:/home/project/site/site# 

I'm pretty sure the errors are related. From looking up the error I found enabling the google storage API can fix the issue and it created default buckets for the project. The Storage API is now enabled and I can see the buckets have been enabled but the error is still there.

Maybe I need to create some sort of permissions from the servers to the buckets but I don't know if this is the problem and if it is what steps to I need to make to setup these permissions?

What do I need to do? I have 2 instances setup and an SQL instance, with a rails app setup on them.

like image 415
Rob Avatar asked Oct 19 '22 10:10

Rob


1 Answers

Zachary Newman is on the right track. Check to see if you are properly authenticated into gcloud. I use one of two options for my projects:

gcloud auth login

OR

gcloud auth activate-service-account --key-file SERVICE_ACCOUNT_JSON

I use the first for my personal testing. I use the second on my CI service. To create the service account JSON, from the main menu on the Google Cloud project:

  • Navigate to "Permissions > Service Accounts tab".
  • Click 'Create service account' button.
  • Enter a useful name.
  • Click on 'Furnish a new private key' checkbox
  • Use the JSON key type.
  • Click 'Create' button.

This is the only chance you'll get to save the JSON file so keep it safe.

Try that and see what happens.

like image 199
Stanley Tso Avatar answered Oct 27 '22 11:10

Stanley Tso