Ariel M
Ariel M

Reputation: 41

gcloud functions deploy command always creates new function

I'm trying to update the memory of an existing cloud functions through the cli but instead of updating it creates a new function.

I've tried several commands from the docs but it still creates everytime.

gcloud functions deploy {func_name} --memory=512MB --gen2

gcloud functions deploy {func_name} --trigger-http --memory=512MB --gen2 --project={proj_name} --source=.

gcloud functions deploy {func_name} --memory=512MB --runtime nodejs18 --region {region_name} --gen2 --trigger-http

What is the proper syntax to update an existing cloud functions? I just want to update the memory.

UPDATE: I was able to update the memory by directly changing the value in the cloud functions config through the console. I encountered a couple more issues when trying to do it through cli.

Upvotes: 0

Views: 210

Answers (2)

reaseaonable_tree
reaseaonable_tree

Reputation: 58

Do you mean it's replacing the function? If yes, this is the expected behavior, even if you just intend to update the memory. However, if the command is creating a brand new function, then there must be something wrong.

Since you're deploying a gen2 function, you can see all revisions that Cloud Run creates behind the scenes. Just go to Cloud Run -> {func_name} -> Revisions tab.

This shows that new deployments are not technically "new functions". They are just new revisions under the same service.

Upvotes: 1

Doug Stevenson
Doug Stevenson

Reputation: 317760

There is no such feature in gcloud. You can see the list of gcloud functions commands for yourself in the documentation, and you will find no way to update a function. If you want to change a function, you will need to redeploy it with new options as you are doing now.

Upvotes: 1

Related Questions