【问题标题】:Call a Gen-2 GCP FunctionCall a Gen-2 GCP Function
【发布时间】:2022-12-01 14:37:29
【问题描述】:

I have deployed the following 2 functions on GCP Cloud Function: gcloud functions list

#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

I tried to call both functions from the CLI on the browser, but the gen-2 function (#2) doesn't work.

#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)$

Could anyone please enlighten:

  • How does one call a gen-2 function?
  • Can I call a gen-2 function from the CLI?

【问题讨论】:

    标签: google-cloud-platform devops


    【解决方案1】:
    Answer recommended by Google Cloud

    You have to use --gen2 while calling gen2 functions. The command should be like below

    gcloud functions describe myfunction-no-01-gen2 --region=us-cental1 --gen2
    

    Have a look at this documentation

    And make sure gen2 function is exists in specified region

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-02
      • 2021-09-17
      • 2022-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多