1

I have a Google Cloud Function I've developed. The main.py and requirements.txt file are both in a folder called "hello". Here's the entirety of my main.py file:

import functions_framework
import logging

logging.basicConfig(level=logging.INFO)

@functions_framework.http
def hello(request):
    logging.info('Hello request received')
    return "ok"

When I open a terminal at the hello folder and use the command

functions-framework --target=hello

I receive

Provided code is not a loadable module. Could not load the function, shutting down.

as output. I've reinstalled functions framework, restarted my console, and cannot understand why I'm getting this error since hello is definitely a function name.

Jeffrey Van Laethem
  • 2,601
  • 1
  • 20
  • 30
  • 1
    You should first check that you are using a compatible version of Python (3.7 or higher) and that your `main.py` and `requirements.txt` files are in the same directory. Additionally, make sure that the function name you specified in the `--target` flag matches the name of the function you defined in your `main.py` file, and that you have installed the `functions-framework` module correctly. If the issue persists, try running the Functions Framework with the `--debug` flag for more detailed error messages. – Chanpols Mar 24 '23 at 20:20
  • You installed the `functions-framework` package locally or in a virtual env ? – Mazlum Tosun Mar 24 '23 at 21:47
  • Locally. Seems like if I close my workspace, then reopen it works for a while – Jeffrey Van Laethem Mar 25 '23 at 21:19

0 Answers0