当尝试使用命令将Python项目部署到Google函数时
gcloud functions deploy my_function --entry-point reply --runtime python38 --trigger-http --allow-unauthenticated
我得到了
部署函数(可能需要2分钟)...⠛
对于日志,请访问:https://[...]部署函数(可能需要2分钟)...failed。
错误:(gcloud.functions.deploy) OperationError: code=3,message=Build failed:缺失main.py和未指定GOOGLE_FUNCTION_SOURCE。要么在main.py中创建函数,要么指定GOOGLE_FUNCTION_SOURCE指向包含函数的文件;错误ID: 5c04ec9c
但我在文件夹中确实有一个main.py文件。
我检查了平台,没有上传文件main.py,而文件夹中的文件是。
发布于 2021-05-06 16:21:21
解决方案是从.gcloudignore中省略这一行
#!include:.gitignore我不太明白为什么。
我的.gitignore是:
.*
*.json发布于 2021-09-14 17:31:45
.gcloudignore的内容对我来说很有魅力。我从已经拥有这个自动生成文件的其他项目中复制了它。
FileName:.gcloudignore
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore
node_moduleshttps://stackoverflow.com/questions/67422201
复制相似问题