Sebastian
Sebastian

Reputation: 1101

How to remove file from Google Cloud Functions

Ok this may sound silly, but is there a way to delete a file that has been uploaded to Google Cloud Functions?

I have accidentally uploaded the .cloudignore file and the .python-version file (using gcloud functions deploy). I can't find anything in the documentation (and neither using the web interface).

To clarify further, these are the steps to reproduce:

  1. Deploy cloud function, including .python-version and .cloudignore (version 1)
  2. Edit .cloudignore to ignore .python-version and .cloudignore
  3. Redeploy (version 2)

Expected result: .python-version and .cloudignore are excluded in version 2

Actual result: .python-version and .cloudignore are still there, but are still the same as in version 1 (i.e., they are ignored in the version 2 deployment, but are not removed from the cloud function)

Of course I could delete the function entirely and re-upload it, but there has to be a better way...

Any hints are greatly appreciated.

[screenshot from GCP]

Upvotes: 0

Views: 584

Answers (2)

Jan Hernandez
Jan Hernandez

Reputation: 4630

You can use the console (web UI) and upload a zip file with the content of your cloud function.

This new version will delete all files of the function and only going to upload the content within the zip file.

Upvotes: 1

somethingsomething
somethingsomething

Reputation: 2164

It wouldn't really make any sense to modify the source code of a deployed function without moving to a new version.

You can just deploy a new version of the same function with the correct files ignored.

Upvotes: 2

Related Questions