调用Gen-2 GCP函数



我在GCP Cloud Function上部署了以下2个功能:

# 1

NAME: myfunction-no-01
STATE: ACTIVE
TRIGGER: HTTP Trigger
REGION: us-central1
ENVIRONMENT: 1st gen

# 2

NAME: myfunction-no-01-gen2
STATE: ACTIVE
TRIGGER: HTTP Trigger
REGION: us-central1
ENVIRONMENT: 2nd gen

我尝试在浏览器的CLI中调用这两个函数,但是第2代函数(#2)不起作用。

# 1

webmaster@cloudshell:~ (my-project)$ gcloud functions describe myfunction-no-01
availableMemoryMb: 512
buildId: 46c6f552-4987-4998-ac3c-48d62aefe1b
buildName: projects/411817252346/locations/us-central1/builds/46c6f552-4987-4998-ac3c-48d62aefe1b
dockerRegistry: CONTAINER_REGISTRY
entryPoint: entrypoint
environmentVariables:
GDRIVE_CONFIG_YML_FILE_ID: 1WflpktOjJ9zPquHVO45rxuUNo-lBsjr
httpsTrigger:
securityLevel: SECURE_ALWAYS
url: https://us-central1-my-project.cloudfunctions.net/myfunction-no-01
ingressSettings: ALLOW_ALL
labels:
deployment-tool: console-cloud
maxInstances: 3000
name: projects/my-project/locations/us-central1/functions/myfunction-no-01
runtime: python39
serviceAccountEmail: my-project@appspot.gserviceaccount.com
sourceUploadUrl: https://storage.googleapis.com/uploads-204034571949.us-central1.cloudfunctions.appspot.com/874e8ab6-9bac-477e-8430-a8ebbe9262fa.zip
status: ACTIVE
timeout: 540s
updateTime: '2022-10-24T22:20:53.884Z'
versionId: '4'

# 2

webmaster@cloudshell:~ (my-project)$ gcloud functions describe myfunction-no-01-gen2
ERROR: (gcloud.functions.describe) ResponseError: status=[404], code=[Ok], message=[Function myfunction-no-01-gen2 in region us-central1 in project my-project does not exist]
webmaster@cloudshell:~ (my-project)$

谁能指点一下:

  • 如何调用gen-2函数?
  • 可以在CLI中调用gen-2函数吗?

在调用gen2函数时必须使用--gen2。命令应该像

下面这样
gcloud functions describe myfunction-no-01-gen2 --region=us-cental1 --gen2

看一下这个文档

并确保在指定区域存在gen2函数

相关内容

  • 没有找到相关文章

最新更新