Yogesh Devi
Yogesh Devi

Reputation: 689

Google "gcloud functions deploy" command gives error gcloud crashed (TypeError): expected string or bytes-like object, got 'NoneType'

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

Upvotes: 0

Views: 30

Answers (1)

Yogesh Devi
Yogesh Devi

Reputation: 689

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

Upvotes: 0

Related Questions