使用此命令从 GitHub 工作流程进行部署
gcloud functions deploy "$FUNCTION_NAME" \
--entry-point "entry" \
--region northamerica-northeast1 \
--runtime python39 \
--set-env-vars=SENDGRID_API_KEY="$SENDGRID_API_KEY" \
--source "my-source-folder" \
--timeout "540s" \
--trigger-topic "my-trigger-topic"
我收到此错误
Deploying function (may take a while - up to 2 minutes)...
..
For Cloud Build Logs, visit: https://console.cloud.google.com/cloud-build/builds;region=northamerica-northeast1/<<snip>>
...............................failed.
ERROR: (gcloud.functions.deploy) OperationError: code=13, message=None
Error: Process completed with exit code 1.
我还有另一个使用相同命令行参数成功部署的函数。
如何解决此问题以及|或者如何排除故障?
自我回答:
在谷歌搜索后,没有找到其他人提供的确切的非错误消息,并考虑了 Python 版本有多旧,我怀疑我需要一个更新的运行时。
通过设置我的云项目 (
gcloud config set project my-project
) 并在命令行上本地运行 cloud functions deploy ...
命令,我可以进行一些尝试和错误。
尝试 python312 的运行时产生了一大堆错误。使用 python39 的运行时有效。我听说 3.11 有问题,我很高兴它能工作,所以我继续使用 pyton39。