Reputation: 129
I accidentally, deleted all my cloud function on the CLI, is there anyway to recover it? I tried searching Google Cloud Platform features to restore it but with no avail.
Upvotes: 0
Views: 3537
Reputation: 31
I had this problem today. Here is the solution I found.
Explanation of the solution
apparently, when one creates a function onRequest
function, all the code is uploaded, no matter if it is used or not.
For example:
we have 2 enpoints
GET products
GET history
when creating the cloud function for products, not only the products code is uploaded, but also the history code.
Step by step
then, what you need, is to download the source code, of one of the functions that you currently have active here:
https://console.cloud.google.com/functions
(clearly the function, for which you downloaded the source code, had to be uploaded when you had in your source code, the code you are looking for now)
now you only have to search in that file, the code of the function you are looking for.
Upvotes: 1
Reputation: 2456
I think you can't recover the deleted cloud function. Created a temporary cloud function and deleted the function to check if deleted is showed in the list https://console.cloud.google.com/functions, but the function was removed from the list.
Upvotes: 5