How do i update Google Cloud Function source?

I am running into the same issue. I've deployed my original HTTP function, updated the source, and am now trying to redeploy.

This could perhaps be a bug in the gcloud CLI, but I was able to successfully redeploy from my local machine by leveraging the --source command line flag. Be sure to point this flag to the directory containing your index.js.

gcloud beta functions deploy helloWorld --source=/usr/local/path/to/source/dir --http-trigger

Where index.js would be located at /usr/local/path/to/source/dir/index.js. Further CLI documentation can be found at https://cloud.google.com/sdk/gcloud/reference/beta/functions/deploy.


Providing an updated answer for anyone that needs it. If you are wanting to just redeploy a function from source the following works assuming you are in the directory of the index.js file. And to clarify this is to redeploy to a gcp function that already exists, not a new one.

gcloud functions deploy <FUNCTION_NAME> --source=.