了解 App Engine Flexible - Java SDK 安装错误的问题?

Issue understanding installation error with App Engine Flexible - Java SDK?

我目前正在尝试一个简单的 App Engine 灵活应用程序,并且正在努力解决我认为是设置和权限问题。我尝试了各种不同的安装方法 - 使用 gcloud 和 Maven,以及带有应用程序引擎插件的 IntelliJ,但它们都失败了。

控制台的输出如下:

ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects/n*********/regions/us-central1/operations/6360c25d-5d39-4035-a5d9-fa11cff89d1c error [INTERNAL]: An internal error occurred while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2020-06-23T21:37:26.966Z10514.ow.2: Deployment Manager operation n**********/operation-1592948248075-5a8c72a78db77-432a52c5-14b80019 errors: [code: "RESOURCE_ERROR"
location: "/deployments/aef-default-20200623t223343/resources/aef-default-20200623t223343"
message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"message\":\"The caller does not have permission\",\"status\":\"PERMISSION_DENIED\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://compute.googleapis.com/compute/beta/projects/n**********/regions/us-central1/autoscalers\",\"httpMethod\":\"POST\"}}"
]

Failed to deploy '[2020-06-23 22:33:38] test2.jar. Project: n********. Version: auto': Deployment failed with exit code: 1
Please make sure that you are using the latest version of the Google Cloud SDK.
Run ''gcloud components update'' to update the SDK. (See: https://cloud.google.com/sdk/gcloud/reference/components/update.)

当我打开状态消息时,里面有以下错误:

"error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
      {
        "message": "Login Required.",
        "domain": "global",
        "reason": "required",
        "location": "Authorization",
        "locationType": "header"
      }
    ],
    "status": "UNAUTHENTICATED"
  }

在遵循 Google 快速入门和其他一些示例之后,我正在努力了解出了什么问题以及我需要做些什么来解决这个问题。任何见解将不胜感激。

根据 gcloud.app.deploy 错误的指示,这似乎是您的服务帐户权限问题:

"The caller does not have permission"

您应该按照此 documentation, the App Engine Deployer role is the recommended one for deploying apps, if this does not work you could try to use the Editor role as well, here is the documentation for the app engine service account roles 上的说明检查您用于部署项目的服务帐户是否具有适当的权限,以便您进一步检查。

此外,您可以尝试禁用并重新启用 Cloud Build API,这将重新创建所有权限并覆盖您的服务帐户被破坏的任何权限。

注意:您的服务帐户名称应该是这样的:[YOUR_PROJECT_NAME]@appspot.gserviceaccount.com.

我也遇到了同样的问题。然后我找到了这个thread。是俄语的。您可能需要翻译页面。 'flex' 术语有点伪 btw。

它说您可以为您的 Google App Engine 使用的实例设置 1 到 2 之间的范围,或者将其固定为 2 个实例。

您可以在app.yaml中设置:

自动缩放(范围)

runtime: custom
env: flex

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 2

手动缩放(固定)

runtime: custom
env: flex

manual_scaling:
  instances: 2