Is there a way to stop/disable a Google Cloud Func

2020-07-03 03:56发布

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?

5条回答
狗以群分
2楼-- · 2020-07-03 04:00

Do not export the function. That way you can still keep it unmodified and yet be able to disable it.

查看更多
闹够了就滚
3楼-- · 2020-07-03 04:02

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.

查看更多
贼婆χ
4楼-- · 2020-07-03 04:07

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.

查看更多
戒情不戒烟
5楼-- · 2020-07-03 04:16

I am not sure if this is late but what I did is that I deleted/commented the function I don't need and deployed again using firebase deploy --only functions . Once run, it shows that the function is being deleted. Hope this helpsGCF Deployment

查看更多
够拽才男人
6楼-- · 2020-07-03 04:17

There's no button or switch you can turn to "switch it off". And I prefer to maintan a "single source of truth" when developing, so I removed them. If you have a CI integrated in your git (like gitlab CI) it should be just one click to re-deploy

查看更多
登录 后发表回答