Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 使用Google Cloud SDK部署gcloud应用程序期间权限被拒绝_Google App Engine_Google Cloud Platform - Fatal编程技术网

Google app engine 使用Google Cloud SDK部署gcloud应用程序期间权限被拒绝

Google app engine 使用Google Cloud SDK部署gcloud应用程序期间权限被拒绝,google-app-engine,google-cloud-platform,Google App Engine,Google Cloud Platform,使用谷歌云SDK将应用程序部署到谷歌应用程序引擎是非常困难的 我试过下面两个命令 C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud config set project jstock-android Updated property [core/project]. C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud app deploy app.yaml -

使用谷歌云SDK将应用程序部署到谷歌应用程序引擎是非常困难的

我试过下面两个命令

C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud config set project jstock-android
Updated property [core/project].

C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud app deploy app.yaml --log-http --verbosity=debug
DEBUG: Running [gcloud.app.deploy] with arguments: [--log-http: "true", --verbosity: "debug", DEPLOYABLES:1: "['app.yaml']"]
DEBUG: No staging command found for runtime [python27] and environment [STANDARD].
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1]
=======================
==== request start ====
uri: https://appengine.googleapis.com/v1/apps/jstock-android?alt=json
method: GET
== headers start ==
Authorization: Bearer ya29.GlxEBb1XVP1JK93-ARiaN_ZgiMbvZmw5KWfvJVfibDJ4FK_ZaMRoU1jVDTiWzsY606GSduJKJd9Nm8zA-_Iql5mGn4AMk4QVl8mPRycfekeZnOOHtbUvpkBMgOLOQA
accept: application/json
accept-encoding: gzip, deflate
content-length: 0
user-agent: google-cloud-sdk x_Tw5K8nnjoRAqULM9PFAC2b gcloud/184.0.0 command/gcloud.app.deploy invocation-id/c9ae232d33b346d787b95a36e28c38c0 environment/None environment-version/None interactive/True python/2.7.13 (Windows NT 10.0.16299)
== headers end ==
== body start ==

== body end ==
==== request end ====
---- response start ----
-- headers start --
-content-encoding: gzip
alt-svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
cache-control: private
content-length: 335
content-type: application/json; charset=UTF-8
date: Tue, 16 Jan 2018 19:16:21 GMT
server: ESF
status: 403
transfer-encoding: chunked
vary: Origin, X-Origin, Referer
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
-- headers end --
-- body start --
{
  "error": {
    "code": 403,
    "message": "Operation not allowed",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ResourceInfo",
        "resourceType": "gae.api",
        "description": "The \"appengine.applications.get\" permission is required."
      }
    ]
  }
}

-- body end --
total round trip time (request+response): 1.796 secs
---- response end ----
----------------------
DEBUG: (gcloud.app.deploy) Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 797, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 757, in Run
    resources = command_instance.Run(args)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py", line 65, in Run
    parallel_build=False)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 543, in RunDeploy
    app = _PossiblyCreateApp(api_client, project)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 703, in _PossiblyCreateApp
    api_client._FormatApp())))  # pylint: disable=protected-access
HttpException: Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
ERROR: (gcloud.app.deploy) Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.

C:\Users\yccheok\Desktop\jstock-android-appengine>
然后,我浏览了一遍,它提到我需要使用管理API。所以,我一步一步小心地做

第一步

步骤2

它提到管理API已启用。现在我需要凭证

步骤3

步骤4

嗯。现在他们提到我不需要创建新的凭证。我可以使用应用程序默认凭据

步骤5 所以,我去了。我知道我需要跑步

C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud auth application-default login
Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&access_type=offline



Credentials saved to file: [C:\Users\yccheok\AppData\Roaming\gcloud\application_default_credentials.json]

These credentials will be used by any library that requests
Application Default Credentials.
步骤6

步骤7


尽管如此,在完成上述7个步骤后,我仍然会在尝试运行时收到完全相同的错误消息

gcloud app deploy app.yaml --log-http --verbosity=debug
有人能告诉我,为了使用Google Cloud SDK将我的Python应用程序部署到Google app Engine,我还需要什么步骤吗?

管理API用于以编程方式部署应用程序,而不是使用
gcloud app deploy
进行部署,您甚至不需要为应用程序启用管理API

发件人:

要以编程方式部署应用程序,请使用

在你开始之前

在部署应用程序之前:

  • 必须创建GCP项目的

  • 请确保您的用户帐户包括

(但我可以看出,上述内容可能被错误地描述为使用管理API的邀请)

gcloud app deploy
实际使用的帐户很可能丢失或不具备所需的权限

您可以检查与
gcloud auth list
一起使用的帐户。在我的情况下,帐户是我的电子邮件地址,而不是服务帐户(我不确定是否可以使用服务帐户)

如果您需要其他帐户,请使用
gcloud auth login
(也可以使用
gcloud auth revoke


您可以在上查看项目/应用程序上的帐户权限(如果有)。

关于这一点的另一个注意事项, 启用App Engine API和cloud builder API时,请确保cloud Build服务帐户也可以访问该项目

启用正确的API后,我遇到了这个问题

这是使用构建触发器。我可以从命令行在本地部署,因为我已通过身份验证。但是,如果您使用的是生成触发器,它将使用需要访问的生成服务帐户


希望这有帮助。

我遇到了这个问题。在我的例子中,它是通过使用项目ID而不是项目名称来设置项目来解决的。看到这个答案了吗


你的回答帮助我了解了我的问题:我的问题。谢谢这就是问题所在!如果您希望cloud build能够将服务升级到最新版本或进行流量拆分,您可能还希望将“App Engine Service Admin”角色授予cloud build服务帐户。@GovindRai但是
gcloud App deploy
应该仍然有效吗?或者你是说只有
gcloud app deploy——没有促销
会起作用吗?这是一个很好的问题。我不完全肯定,但可能-没有推广应该工作,因为它只是部署,而不是分裂流量。试用?撤消访问是删除另一个项目的身份验证的关键。用项目id替换项目名称对我来说很有效,谢谢!