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\"
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.