简体   繁体   English

云 Function 部署 gen2 - function 已经存在错误?

[英]Cloud Function deploy gen2 - function already exist error?

As I used to do in gen1, I first create a new function named func_name on the web UI , with a Function entry name .正如我在 gen1 中所做的那样,我首先在 web UI上创建一个名为func_name的新 function, Function entry name为 Function。

Then on the CLI (Terminal):然后在 CLI(终端)上:

sudo gcloud functions deploy func_name --runtime=python39  --region=us-central1 --trigger-http

I keep getting the same error that:我不断收到同样的错误:

Failed to create function, function already exists under 2nd gen environment

Of course it exist, I created it first via web so I can deploy it (?)它当然存在,我首先通过 web 创建了它,所以我可以部署它(?)

EDIT : Removing the Function from the web UI, then deploy it first time from cli will create a gen1 Function not 2. To create gen2 function we need to add the flag --gen2 , which amazingly produce error "unrecognized argument gen2" if you add it ( https://cloud.google.com/functions/docs/deploy )编辑:从 web UI 中删除 Function,然后第一次从 cli 部署它会创建一个gen1 Function 而不是 2。要创建gen2 function,我们需要添加标志--gen2 ,如果你添加它( https://cloud.google.com/functions/docs/deploy

It seems to me that gen2 is some sort of beta version with so many unclear problems that I spend hours to solve.在我看来, gen2是某种 beta 版本,有很多不清楚的问题,我花了几个小时来解决。

I found a similar problem and solved by specifying the beta subcommand, so removing the Function from the web UI, then deploying it from the cli with我发现了一个类似的问题并通过指定beta子命令解决了,因此从 web UI 中删除了 Function,然后从 cli 中部署它

sudo gcloud beta functions deploy func_name --runtime=python39  --region=us-central1 --trigger-http --gen2

should work for you too也应该为你工作

Concerning the gen2 error "unrecognized argument gen2", try to update your gcloud: gcloud components update .关于 gen2 错误“unrecognized argument gen2”,请尝试更新您的 gcloud: gcloud components update It worked for me!它对我有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM