14

I run the following commands:

gcloud auth activate-service-account --key-file key.json
gcloud config set project my-project

For some reason I am getting this error:

WARNING: You do not appear to have access to project [project] or it does not exist.

I have the following roles on my IAM:

  • App Engine Admin
  • Cloud Build Editor
  • Cloud Scheduler Admin
  • Storage Object Creator
  • Storage Object Viewer

Does anyone know why this would be happening? Is there something specific I am missing?

Promise Preston
  • 8,732
  • 5
  • 43
  • 70
bryan
  • 7,656
  • 12
  • 65
  • 136
  • I'm seeing the same thing when attempting `gcloud config set project my-project`. The key I'm using worked fine yesterday and I've not made any IAM changes. I've also verified the Id of the key I'm using is what's specified in the Service Accounts listed in the console. – eversMcc Nov 14 '19 at 11:56
  • 1
    Worth noting that it's a warning, rather than an error. I can still use the key in question successfully, despite getting the warning you've detailed. Does your key work when you interact with GCP after you get the warning? – eversMcc Nov 14 '19 at 12:22
  • @eversMcc is right. It ended up just being an error and it wasn't working because of an entirely different reason with my `gcloud app deploy` command. – bryan Nov 14 '19 at 14:06

4 Answers4

34

The solution to this issue might be to enable Cloud Resource Manager api in your Google Cloud Console. Go to https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=<project-id> and click enable.

Buchanora
  • 459
  • 1
  • 5
  • 4
12

I believe this is an erroneous warning message. I see the same warning message on my service account despite the fact that the account has permissions on my GCP project and can successfully perform necessary actions.

You might be seeing this error due to an unrelated problem. In my case, I was trying to deploy to AppEngine from a continuous integration environment (Circle CI), but I hadn't enabled the App Engine Admin API. Once I enabled the API, I was able to deploy successfully.

mtlynch
  • 3,137
  • 4
  • 25
  • 29
  • You are correct - It ended up just being an error and it wasn't working because of an entirely different reason with my gcloud app deploy command – bryan Dec 09 '19 at 19:29
  • 1
    Agreed and confirmed - this typically occurs when something is invalid and it just shows this weird generic error message. This can commonly occur when an environment var is invalid or missing. – Cameron Mar 07 '20 at 00:09
  • For my case it turned out that I provided wrong project name. – Konstantin Kozirev Mar 24 '20 at 23:37
  • Gah, this happened to me as well! The error following this warning was the real problem. – David Calhoun Oct 23 '20 at 20:58
10

I encountered this error when I started out with Google CLoud Platform.

The issue was that I configured/set a non-existing project (my-kube-project) as my default project using the command below:

gcloud config set project my-kube-project

Here's how I solved it:

I had to list my existing projects first:

gcloud projects list

And then I copied the ID of the project that I wanted, and rannthe command again this time:

gcloud config set project gold-magpie-258213

And it worked fine.

Note: You cannot change the ID of a project's ID or Number,you can only change the Name.

That's all.

I hope this helps

Promise Preston
  • 8,732
  • 5
  • 43
  • 70
3

I was encountering the same error when trying to deploy an app to Google App Engine via a service account configured in CircleCI and resolved it by having the following roles (permissions) attached to my service role:

  • App Engine Deployer
  • App Engine Service Admin
  • Cloud Build Editor
  • Storage Object Creator
  • Storage Object Viewer

I also had the App Engine Admin API enabled, but not the Cloud Resource Manager API.

Mark
  • 629
  • 10
  • 19