Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to stop/disable a Google Cloud Function?

Tags:

I have running multiple Google Cloud functions. One is not operating well, so I want to stop them until I've fixed the situation.

I have seen that I can remove the function, but is there a way to disable and later; enable the function?

like image 797
Johan Walhout Avatar asked Apr 28 '17 13:04

Johan Walhout


People also ask

Are Google cloud functions always running?

There is no concept on a forever-running function on Cloud Functions (nor on other, similar Functions-as-a-Service offerings), although it's definitely possible to create a function that gets triggered every minute or so (like a cron job). This user is first on the weekly Google Cloud leaderboard.

How do I disable Google Cloud API?

Disable an API Go to the API Console. From the projects list, select a project or create a new one. If the API Manager page isn't already open, open the console left side menu and select API Manager. Next to the API you want to disable, click Disable.

How to disable Cloud Logging in gcp?

On the Edit page, select Customize. Under Enforcement, select an enforcement option: To enable the constraint and disable Cloud Logging, select On. To disable the constraint and enable Cloud Logging, select Off.


2 Answers

You cannot disable a function. Just comment the function body. It would be a good practice to log the call in the console and then return null so you can keep track whenever the function is invoked.

like image 77
Diego P Avatar answered Sep 21 '22 08:09

Diego P


Follow up for anyone else looking for this, I created an ENV variable and added an if check before my function executes. Ex:

if os.environ['functionOn'] == 'true':     # insert previous function code here 

Can change function on/off with ENV variable change from console + redeploy.

like image 43
whla Avatar answered Sep 17 '22 08:09

whla