I am using cloud function to deploy a python function (version=3.7, memory=1go and timeout=1s).
So far, it perfectly works.
However, I've noticed that, by default, the cloud function has its region set to us-central1
.
I need my function to be in europe-west1
so I've change the region (https://cloud.google.com/functions/docs/locations) using
gcloud function deploy .... --region europe-west1
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. Error message: Error: function load attempt timed out
I don't understand why it works with us-central1 and not europe-west1.
Any ideas ?
Thx for your help !
EDIT :
Thx Renaud and Pablo
Typos were in my message, but I think I got the right command. Here it is :
gcloud functions deploy my_test --entry-point my_test_1 --runtime python37 --memory 1024MB --region=europe-west1 --trigger-http
And I still got the same error message.
But this
gcloud functions deploy my_test --entry-point my_test_1 --runtime python37 --memory 1024MB --trigger-http
works fine.
Hope someone has an idea :) Thank you !
Updated following your update (and Pablo Almécija Rodríguez's answer):
You have to follow this doc (i.e. the "complete reference for the deploy command") and add =
when it is needed, as detailed in the doc:
gcloud functions deploy (NAME : --region=REGION) [--entry- point=ENTRY_POINT] [--memory=MEMORY] [--retry] [--runtime=RUNTIME] [--service-account=SERVICE_ACCOUNT] [--source=SOURCE] [--stage-bucket=STAGE_BUCKET] [--timeout=TIMEOUT] [--update-labels=[KEY=VALUE,…]] [--clear-env-vars | --env-vars-file=FILE_PATH | --set-env-vars=[KEY=VALUE,…] | --remove-env-vars=[KEY,…] --update-env-vars=[KEY=VALUE,…]] [--clear-labels | --remove-labels=[KEY,…]] [--trigger-bucket=TRIGGER_BUCKET | --trigger-http | --trigger-topic=TRIGGER_TOPIC | --trigger-event=EVENT_TYPE --trigger-resource=RESOURCE] [GCLOUD_WIDE_FLAG …]
So you should do:
gcloud functions deploy my_test --entry-point=my_test_1 --runtime=python37 --memory=1024MB --timeout=1s --region=europe-west1 --trigger-http