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

前端 未结 5 1206
渐次进展
渐次进展 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:18

    Is your cloud function doing anything before it reaches the entry point function you've assigned? If any unhandled exceptions happen, GCF will not reach the entry point function and throw this error. For example:

    class SomeClass:
        def __init__(self):
            raise ValueError
    
    err = SomeClass()
    
    def main(event, context):
        pass
    
    

    Will raise the same error: Function load error: File main.py that is expected to define function doesn't exist. That's because your entry point function is never reached. Review the code that runs before your function is defined and you'll likely find something amiss.

提交回复
热议问题