Google "gcloud functions deploy" command gives error gcloud crashed (TypeError): expected string or bytes-like

admin2025-04-22  0

I am trying to create cloud functions using my existing scripts
I run commands as shown below to create a cloud function <my_function>

"gcloud functions deploy <my_function> --no-gen2 --region=us-central1 - 
-entry-point=handle_event --memory=256MB --retry --runtime=python310 -- 
source=gs://<mybucket>/<myfunction.zip> -- 
timeout=30 --trigger-topic=<my pubsub> --set-env-vars=MYSQL_USER=<myuser>,MYSQL_PASSWORD=<mypass>,MYSQL_DATABASE=<mydb>,INSTANCE_CONNECTION_NAME=<myproject>:us-central1:<mydb>" --build-service-account=<mybuildservice account>

When I run this command I get an error "ERROR: gcloud crashed (TypeError): expected string or bytes-like object, got 'NoneType'"

gcloud does not throw any more information

I am stuck ; please help me resolve this error

I am trying to create cloud functions using my existing scripts
I run commands as shown below to create a cloud function <my_function>

"gcloud functions deploy <my_function> --no-gen2 --region=us-central1 - 
-entry-point=handle_event --memory=256MB --retry --runtime=python310 -- 
source=gs://<mybucket>/<myfunction.zip> -- 
timeout=30 --trigger-topic=<my pubsub> --set-env-vars=MYSQL_USER=<myuser>,MYSQL_PASSWORD=<mypass>,MYSQL_DATABASE=<mydb>,INSTANCE_CONNECTION_NAME=<myproject>:us-central1:<mydb>" --build-service-account=<mybuildservice account>

When I run this command I get an error "ERROR: gcloud crashed (TypeError): expected string or bytes-like object, got 'NoneType'"

gcloud does not throw any more information

I am stuck ; please help me resolve this error

Share Improve this question asked Jan 31 at 7:34 Yogesh DeviYogesh Devi 70914 silver badges35 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I ran the same command with verbosity set to debug as follows

enter code here
"gcloud functions deploy <my_function> --no-gen2 --region=us-central1 - 
-entry-point=handle_event --memory=256MB --retry --runtime=python310 -- 
source=gs://<mybucket>/<myfunction.zip> -- 
timeout=30 --trigger-topic=<my pubsub> --set-env-vars=MYSQL_USER= 
<myuser>,MYSQL_PASSWORD=<mypass>,MYSQL_DATABASE= 
<mydb>,INSTANCE_CONNECTION_NAME=<myproject>:us-central1:<mydb>" --build-service-account=<mybuildservice account> --verbosity=debug

And that gave me a exact problem behind error "please provide the build service account in the format projects/[project_id]/serviceaccounts/[service_account_email]]"

I was giving just the service account e-mail

After I corrected that to needed format the error went away

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745276212a293887.html

最新回复(0)