I have a directory structure that looks like this:
src/
main.py
requirements.txt
Since there doesn't seem to be any configurability surrounding where to look for requirements.txt
, I have been resigned to running gcloud functions deploy
in the outer directory, and I was hoping that the --entry-point
flag might give me some wiggle room to target main.py
inside src
. Unfortunately, it seems to only define a method name.
So is there any way to make this work aside from forcing main.py
and requirements.txt
to be in the same directory?
For reference, the command I'm trying to run and corresponding error message:
gcloud functions deploy refresh_classes --entry-point main --runtime python37 --trigger-resource send_refresh --trigger-event google.pubsub.topic.publish --timeout 540s
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. Error message: File main.py that is expected to define function doesn't exist
It's not possible by configuring gcloud
alone, or without additional source files. Cloud Functions expects a single source
directory which contains both a requirements.txt
and main.py
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With