Google Cloud Shell is using project=cloud-devshell-dev instead of my actual project, can't find enabled APIs

别来无恙 提交于 2019-12-01 21:30:29

问题


I created a GCP project to play around with the video-intelligence API. I enabled the API on my project and launched a Cloud Shell.

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

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

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

Why is it pointing to project=cloud-devshell-dev and not to my videointel project?

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


回答1:


Create a service account and have your application use it for API access, 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-project with your Project ID.



来源:https://stackoverflow.com/questions/44184869/google-cloud-shell-is-using-project-cloud-devshell-dev-instead-of-my-actual-proj

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!