部署云功能时出现问题

2024-03-29 12:20:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我是GCP的新手。我创建了一个云函数并尝试部署它。我在部署时遇到以下错误。有人能帮我解决这个问题吗?谢谢大家!

Command: 
gcloud functions deploy first_cloud_function_http --runtime python37 --trigger-http --allow-unauthenticated --verbosity debug

Error Logs:
DEBUG: Running [gcloud.functions.deploy] with arguments: [--allow-unauthenticated: "True", --runtime: "python37", --trigger-http: "True", --verbosity: "debug", NAME: "first_cloud_function_http"]
INFO: Not using ignore file.
INFO: Not using ignore file.
Deploying function (may take a while - up to 2 minutes)...failed.                                                                            
DEBUG: (gcloud.functions.deploy) OperationError: code=13, message=Failed to initialize region (action ID: 78ed38913711b6cd)
Traceback (most recent call last):
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 808, in Run
    resources = command_instance.Run(args)
  File "/home/hasher/GN/google-cloud-sdk/lib/surface/functions/deploy.py", line 351, in Run
    return _Run(args, track=self.ReleaseTrack())
  File "/home/hasher/GN/google-cloud-sdk/lib/surface/functions/deploy.py", line 305, in _Run
    on_every_poll=[TryToLogStackdriverURL])
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/util.py", line 318, in CatchHTTPErrorRaiseHTTPExceptionFn
    return func(*args, **kwargs)
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/util.py", line 369, in WaitForFunctionUpdateOperation
    on_every_poll=on_every_poll)
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 151, in Wait
    on_every_poll)
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 121, in _WaitForOperation
    sleep_ms=SLEEP_MS)
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 219, in RetryOnResult
    result = func(*args, **kwargs)
  File "/home/hasher/GN/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 73, in _GetOperationStatus
    raise exceptions.FunctionsError(OperationErrorToString(op.error))
googlecloudsdk.api_lib.functions.exceptions.FunctionsError: OperationError: code=13, message=Failed to initialize region (action ID: 78ed38913711b6cd)
ERROR: (gcloud.functions.deploy) OperationError: code=13, message=Failed to initialize region (action ID: 78ed38913711b6cd)

Tags: runinpycloudhomelibgoogleline
1条回答
网友
1楼 · 发布于 2024-03-29 12:20:17

注意,正如gcloud functions deploy命令文档中所述,您必须设置 region标志

要检查云函数可用的可用区域,请参阅以下sections of the documentation

例如,如果要在europe-west1区域部署函数,运行以下命令即可:

gcloud functions deploy first_cloud_function_http  region europe-west1  runtime python37  trigger-http  allow-unauthenticated  verbosity debug

此外,如果您希望避免使用 region标志,可以通过运行以下命令set a default region用于云函数:

gcloud config set functions/region REGION

您可以将REGION字段更改为locations mentioned above中的任何一个

相关问题 更多 >