Google Cloud Shell uses project = cloud-devshell-dev instead of my actual project, cannot find activated APIs

I created a GCP project to play around with the video info API. I included the API in my project and launched Cloud Shell.

Then I copied the code from github and followed the README instructions.

However, when I try to start faces.py, I get this error message:

StatusCode.PERMISSION_DENIED, the Google Cloud Video Intelligence API has not been used in the cloud-devshell-dev project before or is disabled. Turn it on by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=cloud-devshell-dev then try again

Why does this indicate project=cloud-devshell-dev, not my project videointel?

If I gcloud config list, I can see the correct project and service account. Upset.

+3
source share
1 answer

Create a service account and ask her to use it to access the API, run:

  $ gcloud iam service-accounts create my-account
  $ gcloud iam service-accounts keys create key.json
    --iam-account=my-account@my-project.iam.gserviceaccount.com
  $ export GOOGLE_APPLICATION_CREDENTIALS=key.json

In the second command, replace my-projectwith your project identifier.

+5
source

Source: https://habr.com/ru/post/1692972/


All Articles