尝试使用命令将 Python 项目部署到 Google Cloud 函数时
gcloud functions deploy my_function --entry-point reply --runtime python38 --trigger-http --allow-unauthenticated
我明白
<块引用>正在部署函数(可能需要一段时间 - 最多 2 分钟)...⠛
如需 Cloud Build Stackdriver 日志,请访问:
https://[...]
部署函数(可能需要一段时间 - 最多 2 分钟)...失败。
错误:(gcloud.functions.deploy)操作错误:代码=3,消息=构建
失败:缺少 main.py 和 GOOGLE_FUNCTION_SOURCE 未指定。
在 main.py 中创建函数或指定
GOOGLE_FUNCTION_SOURCE 指向包含
功能;错误 ID:5c04ec9c
但我的文件夹中有一个 main.py
文件。
我检查了平台,文件 main.py
没有上传,而文件夹中的文件正在上传。
答案 0 :(得分:1)
解决方案是从 .gcloudignore
中省略这一行:
#!include:.gitignore
我真的不明白为什么。
我的 .gitignore
是:
.*
*.json