GCP Cloud Function source_repository syntax:

For GCP Cloud function can someone give me an example of what the url should look like for “source_repository” ?

I believe I need to use the following format to read from Github (from the docs)

To refer to a moveable alias (branch): 


To refer to HEAD, use the master moveable alias.

Exactly what needs to be replaced here?

Do the keywords “projects”, “repos”, “paths” remain or are replaced.

What am I suppose to do with the “*” in the example syntax?

I have something like the following url displayed in Google Cloud Repositories pointing the function source folder:


I’ve used this as the url and I get an error

Error: Error applying plan:

1 error(s) occurred:

* google_cloudfunctions_function.cloud_function_training_data: 1 error(s) occurred:

* google_cloudfunctions_function.cloud_function_training_data: googleapi: Error 400: The request has errors, badRequest

Also it seems to me the url in the docs:


is outdated as it gets redirected to:


I’ve also tried to use the format specified in the doc, which also reports an error?


Confused with how to get this working?

1 Like

Anyone on this? I totally agree with @rajinder-yadav !

Came across the same issue. I fixed this by setting the source_repository_url in the following format:


  1. {{project_name}} is the name of your project
  2. {{repository_name}} is the name your cloud source repository
  3. The code of the function was located inside functions/{{function_name}} so this will probably be different for you.

If this still doesn’t work you can do the other approach. Create a demo function and set the repository there. After that manually get it by running the following gcloud command for example.

gcloud functions describe demo --region=europe-west2