Python 部署错误的端点 quickstart-app-engine

Endpoints quickstart-app-engine for Python deploy error

我正在尝试按照 here 中的分步教程进行操作,但是部署就是行不通,总是 returning Error Response: [13] An internal error occurred.

我没有更改示例代码本身的任何内容。正如我所说,我只是仔细按照链接的教程进行操作。当我尝试 gcloud app deploy.

时失败并且 return 上面的错误

使用gcloud app deploy --verbosity debug它带来了一些堆栈跟踪,但没有任何有用的意义。为了完整起见,我在下面复制:

Updating service [default] (this may take several minutes)...failed.
DEBUG: (gcloud.app.deploy) Error Response: [13] An internal error occurred
Traceback (most recent call last):
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 791, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 756, in Run
    resources = command_instance.Run(args)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/surface/app/deploy.py", line 65, in Run
    parallel_build=False)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 587, in RunDeploy
    flex_image_build_option=flex_image_build_option)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 395, in Deploy
    extra_config_settings)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 188, in DeployService
    message=message)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 244, in WaitForOperation
    sleep_ms=retry_interval)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 266, in WaitFor
    sleep_ms=sleep_ms)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 222, in RetryOnResult
    if not should_retry(result, state):
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 260, in _IsNotDone
    return not poller.IsDone(operation)
  File "/Users/jamesmiranda/Documents/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 169, in IsDone
    encoding.MessageToPyValue(operation.error)))
OperationError: Error Response: [13] An internal error occurred
ERROR: (gcloud.app.deploy) Error Response: [13] An internal error occurred

下面是 app.yaml(与示例 git 完全相同,除了 APPID):

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app

runtime_config:
  python_version: 3

# [START configuration]
endpoints_api_service:
  # The following values are to be replaced by information from the output of
  # 'gcloud endpoints services deploy openapi-appengine.yaml' command.
  name:  echo-api.endpoints.MYAPPID.cloud.goog
  config_id: [2018-01-09r1]
 # [END configuration]

到目前为止我尝试了什么:

没有任何效果。我做错了什么?

备注:

如果您使用的 app.yaml 文件与您在问题中复制的文件完全相同,那么您输入的名称和配置 ID 似乎有误。根据您问题中提供的信息,您的 app.yaml 应该如下所示:

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app

runtime_config:
  python_version: 3

# [START configuration]
endpoints_api_service:
  # The following values are to be replaced by information from the output of
  # 'gcloud endpoints services deploy openapi-appengine.yaml' command.
  name:  "echo-api.endpoints.MYAPPID.cloud.goog"
  config_id: "2018-01-09r1"
 # [END configuration]

看到您没有在引号内输入名称和 config_id 的值,而且您也不应该在括号内输入 config_id。

我自己试过了,效果不错。如果它仍然不适合你,可能你的名字不正确,因为格式似乎是:

  • "example-project.appspot.com"

因此,如果您的项目 ID 是 my-project-id,那么您的名字将如下所示:

"my-project-id.appspot.com"