Everytime I try to deploy a function I get an error:
ERROR: gcloud crashed (TypeError): expected string or bytes-like object
I uploaded the same code manually in a zip file and there were no problems.
This is the command:
gcloud functions deploy myfunction \
--runtime python39 \
--trigger-http \
--entry-point main \
--source . \
--region europe-west1 \
--project myproject \
--env-vars-file env.json
With debug anbled:
DEBUG: expected string or bytes-like object
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 987, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 807, in Run
resources = command_instance.Run(args)
File "/usr/lib/google-cloud-sdk/lib/surface/functions/deploy.py", line 104, in Run
return command_v2.Run(args, self.ReleaseTrack())
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/functions/v2/deploy/command.py", line 1065, in Run
_SetInvokerPermissions(args, function, is_new_function)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/functions/v2/deploy/command.py", line 866, in _SetInvokerPermissions
service_ref_one_platform = resources.REGISTRY.ParseRelativeName(
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/resources.py", line 1082, in ParseRelativeName
return parser.ParseRelativeName(
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/resources.py", line 203, in ParseRelativeName
match = re.match(path_template, relative_name)
File "/usr/lib/google-cloud-sdk/platform/bundledpythonunix/lib/python3.9/re.py", line 191, in match
return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object
ERROR: gcloud crashed (TypeError): expected string or bytes-like object
Based on your comment, it seems like you are using the older version of Google Cloud SDK 411.0.0
, which is causing the below error message:
ERROR: gcloud crashed (TypeError): expected string or bytes-like object
I have tried deploying the simple Hello World
function by following the Documentation with the latest version of Gcloud CLI 468.0.0
and able to deploy successfully.
Try upgrading to the latest version of Google Cloud SDK 468.0.0
and redeploy. It should work as expected.