google-cloud-platform - 谷歌云功能 : missing main. py

标签 google-cloud-platform google-cloud-storage

尝试使用命令将 Python 项目部署到 Google Cloud 函数时

gcloud functions deploy my_function --entry-point reply --runtime python38 --trigger-http --allow-unauthenticated

我明白了

Deploying function (may take a while - up to 2 minutes)...⠛
For Cloud Build Stackdriver Logs, visit: https://[...] Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: missing main.py and GOOGLE_FUNCTION_SOURCE not specified. Either create the function in main.py or specify GOOGLE_FUNCTION_SOURCE to point to the file that contains the function; Error ID: 5c04ec9c

但我在文件夹中确实有一个 main.py 文件。

我检查了平台,文件 main.py 没有被上传,而文件夹中的文件被上传。

最佳答案

解决方案是从 .gcloudignore 中省略这一行:

#!include:.gitignore

我真的不明白为什么。

我的 .gitignore 是:

.*
*.json

关于google-cloud-platform - 谷歌云功能 : missing main. py,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67422201/

相关文章:

go - 将行写入 Cloud Bigtable 时出现客户端错误

google-cloud-storage - 如何从浏览器访问 Google Cloud Storage 存储分区中的文件?

java - 延迟递归 Java 8 流

azure - 来自 Google Cloud 的出站流量

mysql - 通过Google代理将本地Spring Boot应用程序连接到Google Cloud SQL

javascript - 如何从@google-cloud/storage读取文件?

google-cloud-platform - 我可以在不购买域名的情况下为我的 Google Cloud Storage 设置 MainPageSuffix 吗?

go - Go pub 子库中 PullWait 的行为?

google-cloud-platform - 使用 Colaboratory 永久允许 Google Cloud SDK 访问您的 Google 帐户

google-cloud-platform - Google Cloud Speech API longrunningrecognize 仅返回名称