Google Cloud Function - Function load error: File main.py that is expected to define function doesn't exist

前端 未结 5 1170
渐次进展
渐次进展 2021-01-04 16:36

I am trying to implement a Google Cloud function that is based on code in a Git style repository. I have the code linked to Google Cloud Platform\'s \"Source Repositories\"

5条回答
  •  礼貌的吻别
    2021-01-04 17:02

    If despite the other answers, you're still not able to make it work, I finally got rid of this error by doing the following:

    • make sure your paths to files are correct (especially json files if you're loading your credentials from them, watch out relative paths)
    • check your requirements.txt file: I was using pipreqs to auto generate it but it did some mistakes ("_" instead of "-" for modules like google-cloud-tasks for instance). I'd recommend writing the requirements.txt yourself based on your imports.

    I hope this helps.

提交回复
热议问题