Cloud Functions 関数はもう作れない?Cloud Run functions の謎に迫る

Cloud Functions 関数はもう作れない?Cloud Run functions の謎に迫る

English follows Japanese.

結論

Web UI から、gcloud functions list で得られるような "関数" を作成することはできなくなりました。しかし、Cloud Run Service で "function" として見える関数を作成することは可能です。

gcloud functions detach というコマンドが存在しており、(実行はしてみませんでしたが)gcloud functions list で得られる関数を、得られない関数に変換できるようです。

きっかけ

「Cloud Functions 関数はもう作れない?Cloud Run functions の謎に迫る」というタイトルと「あなたはこの2つの関数が区別できますか?Cloud Run functions の謎に迫る」というタイトルと、ちょっぴり悩みました。

3つの同じように見える関数

この画像の、3つの同じように見える関数のうち、pubsub-to-bq だけが gcloud functions list で得られる関数です。残りの2つは gcloud functions list では得られません。

過去に私は、Cloud Run functions 関数を確かに作成したはずでした。今回、作成済みのサービスを Terraform にインポートしようとしたところ、あれ、インポートできない?となりました。gcloud functions list で確認したところ、「昔作った関数」はあるが「この間作った関数」はない、という状態でした。
そうです、繰り返しになりますが、画面には存在するのに、gcloud functions list で得られない関数が存在するのです。

この日がその日だ (2025-02-19)

2025-02-19 こんな記述がリリースノートに現れました。

Support for deploying v2 functions in Cloud Run is now in general availability (GA). This lets you customize your function as you would a Cloud Run service. This change removes support for creating, deploying, or updating v2 functions in the Google Cloud console. However, you can still manage functions created with the Cloud Functions v2 API using the Cloud Functions gcloud CLI, the Cloud Functions v2 API, or the Cloud Run Cloud Console. See Cloud Run functions comparison for more details.

Gemini による日本語訳です:

Cloud Run での v2 関数のデプロイのサポートが一般提供 (GA) されました。 これにより、Cloud Run サービスと同様に関数をカスタマイズできるようになります。この変更に伴い、Google Cloud コンソールにおける v2 関数の作成、デプロイ、および更新のサポートは終了します。ただし、Cloud Functions v2 API を使用して作成された関数の管理は、Cloud Functions gcloud CLI、Cloud Functions v2 API、または Cloud Run の Cloud コンソールを使用して引き続き行うことが可能です。詳細については、「Cloud Run functions の比較」をご覧ください。

よっぽど丁寧に考えている人じゃないと

  • あ、UI 変わったな
  • でも、関数は作れるわ
  • 統合がなんか進んだんだな

で終わってしまっていたかもしれません。私たちの「関数を作る」という体験は

  • Web UI では、ちょっと UI が変わったができる
  • gcloud functions deploy では、今まで通りできる

であまり変わらなかったはずです。ところが、実は裏で大きな変化が起きていたのです。

余談(歴史)

  • 2027-03: Cloud Functions (1st gen) Beta
  • 2019-11: Cloud Run GA
  • 2022-02: Cloud Functions (2nd gen) Preview (Cloud Runベース)
  • 2024-08: "Cloud Run functions" に名称変更、Runサービスとしてカスタマイズ可能に
  • 2025-02: コンソールでの v2 関数作成サポート終了(Cloud Run作成フローへの完全移行)

Cloud Functions は、もともと Google が提供していたサーバーレス関数実行環境です。2017-03-09 に "Beta release of Google Cloud Functions" と記述されています。2017-10-19 に v1 API がリリースと書かれています。

2022-02-14 に "Cloud Functions has released Cloud Functions (2nd gen), available at the Preview release level. Cloud Functions (2nd gen) is Google Cloud’s next-generation Functions-as-a-Service offering." と書かれています。第2世代の登場です。"2nd" という文字列が出てくるのはこの日が最初です。2022-12-13 に "The cloudfunctions.googleapis.com/v2 API now supports reading 1st gen functions, using the get and list methods." として、v2 API で v1 関数を読み取れるようになったことが書かれています。"v2" という文字列が出てくるのはこの日が最初です。

2024-08-21 に "You can also deploy new functions, and modify existing functions that were created with the Cloud Functions v2 API in Cloud Run. This enables you to customize your function as you would a Cloud Run service." と書かれています。リリースノート上でも、Cloud Run との関係が明示されました。そして、2nd gen 関数は Cloud Run の service であるというのがはっきり書かれています(リリースノート以外のところで、既に言及されていることは何度もあったはずですが、日付が分からないので、リリースノートを今回は追っています)。"Cloud Run" という文字列が出てくるのはこの日が最初です。

こちらは、Cloud Run の Release Notes です。少し遡って、2019-10-01 に、Cloud Run の Release Notes の最初のエントリがあります。2019-11-14 に GA と書かれています。

2025-02-11 に面白いことが書かれています。"Cloud Run functions created with the Cloud Functions (v2) API (cloudfunctions.googleapis.com) can now be detached so that they can only be managed through the Cloud Run Admin API (run.googleapis.com). です。つまり、関数を関数でなくする!?ことができるようになったのです。不可逆変換で元には戻せないようです。2025-02-19 に、先程の "Google Cloud console" (= Web UI) の話が出てきます。

ということで、Cloud Run が誕生して [2019-10-01] 2年と少し経過してから、Cloud Functions に 2nd gen が登場 [2022-02-14] しています。Cloud Run functions と名前が [2024-08-21] に変わり、リリースノートにも「関数はサービスとして見える」と書いてあります(私の記憶では以前から見えていましたが)。その後、(今までの感覚で作っていた関数が)function ではない Cloud Run service がデフォルトとなり [2025-02-19]、今に至ります。

Cloud Functions の第2世代は、コンテナ実行環境(サービス)である Cloud Run 上で動いています。はっきりと記述された記事は多くないですが、Cloud Functions の第1世代は、App Engine 上で(あるいは App Engine と同じ仕組みで)動いている(いた)と理解されています。

補足

関数を管理する に以下の記述があります。

注: gcloud run コマンドまたは Cloud Run Admin API を使用して Cloud Run functions の関数を作成した場合、その関数を gcloud functions コマンドまたは Cloud Functions v2 API で管理することはできません。

ここでも、ただのサービスと、関数として見えるサービスが異なることが明示されています。

コマンドと API のレスポンス

あるプロジェクトにおいて、コマンドや API のレスポンスの一部を示します。

gcloud functions list
NAME          STATE   TRIGGER       REGION           ENVIRONMENT
pubsub_to_bq  ACTIVE  HTTP Trigger  asia-northeast1  2nd gen
gcloud run services list # LAST DEPLOYED BY と URL の一部は削除
   SERVICE       REGION           URL                                                            LAST DEPLOYED AT
✔  instant2bq    asia-northeast1  https://instant2bq- project number .asia-northeast1.run.app    2026-01-17T14:03:08.591581Z
✔  pubsub-to-bq  asia-northeast1  https://pubsub-to-bq- project number .asia-northeast1.run.app  2024-07-21T09:19:16.329328Z
✔  total2bq      asia-northeast1  https://total2bq- project number .asia-northeast1.run.app      2026-01-17T14:00:12.969052Z

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" https://cloudfunctions.googleapis.com/v2/projects/ project id /locations/-/functions

{
  "functions": [
    {
      "name": "projects/ project id /locations/asia-northeast1/functions/pubsub_to_bq",
      "buildConfig": {
        "build": "projects/ project number /locations/asia-northeast1/builds/7e7fcf21-3346-4697-aed3-ce96c5eb1c25",
        "runtime": "go122",
        "entryPoint": "pubsub_to_bq",
        "source": {
          "storageSource": {
            "bucket": "gcf-v2-sources- project number -asia-northeast1",
            "object": "pubsub_to_bq/function-source.zip",
            "generation": "1721553313671054"
          }
        },
        "dockerRepository": "projects/ project id /locations/asia-northeast1/repositories/gcf-artifacts",
        "sourceProvenance": {
          "resolvedStorageSource": {
            "bucket": "gcf-v2-sources- project number -asia-northeast1",
            "object": "pubsub_to_bq/function-source.zip",
            "generation": "1721553313671054"
          }
        },
        "dockerRegistry": "ARTIFACT_REGISTRY",
        "automaticUpdatePolicy": {}
      },
      "serviceConfig": {
        "service": "projects/ project id /locations/asia-northeast1/services/pubsub-to-bq",
        "timeoutSeconds": 300,
        "environmentVariables": {
          "PROJECT_ID": " project id ",
          "SUBSCRIPTION_ID": "instant_subscription",
          "LOG_EXECUTION_ID": "true"
        },
        "maxInstanceCount": 2,
        "ingressSettings": "ALLOW_ALL",
        "uri": "https://pubsub-to-bq- random string -an.a.run.app",
        "serviceAccountEmail": " project number -compute@developer.gserviceaccount.com",
        "availableMemory": "128Mi",
        "allTrafficOnLatestRevision": true,
        "revision": "pubsub-to-bq-00009-kad",
        "maxInstanceRequestConcurrency": 1,
        "availableCpu": "167m"
      },
      "state": "ACTIVE",
      "updateTime": "2024-07-21T09:19:16.610753517Z",
      "labels": {
        "deployment-tool": "cli-gcloud"
      },
      "environment": "GEN_2",
      "url": "https://asia-northeast1- project id .cloudfunctions.net/pubsub_to_bq",
      "createTime": "2024-07-15T13:12:25.181025243Z",
      "satisfiesPzi": true
    }
  ]
}

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" https://run.googleapis.com/v2/projects/ project id /locations/-/services

{
  "services": [
    {
      "name": "projects/ project id /locations/asia-northeast1/services/instant2bq",
      "uid": "aef5a6c5-ef27-4588-961c-4380699ee9a4",
      // ...
      "template": {
        "scaling": {
          "maxInstanceCount": 1
        },
        "serviceAccount": "instant2bq-sa@ project id .iam.gserviceaccount.com",
        "containers": [
          {
            "name": "instant2bq-1",
            "image": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/instant2bq@sha256:ff99bb1a727a9938ec2f74946d7ae34471c6d971db1ef9e1f300cb820a546d9d",
            // ...
            "baseImageUri": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125"
          }
        ],
        "maxInstanceRequestConcurrency": 1
      },
      // ...
      "urls": [
        "https://instant2bq- project number .asia-northeast1.run.app",
        "https://instant2bq- random string -an.a.run.app"
      ],
      // ...
      "uri": "https://instant2bq- random string -an.a.run.app",
      "buildConfig": {
        "name": "projects/ project number /locations/asia-northeast1/builds/fec8c6a4-dbc8-4c5e-8598-670e90bcb6a1",
        "sourceLocation": "gs://run-sources- project id -asia-northeast1/services/instant2bq/1768658373.776000.zip#1768658374307361",
        "functionTarget": "instant2bq",
        "imageUri": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/instant2bq",
        "baseImage": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125",
        "enableAutomaticUpdates": true
      },
      "etag": "\"CJatrssGEOizzZYB/cHJvamVjdHMvbmstaG9tZS1kYXRhL2xvY2F0aW9ucy9hc2lhLW5vcnRoZWFzdDEvc2VydmljZXMvaW5zdGFudDJicQ\""
    },
    {
      "name": "projects/ project id /locations/asia-northeast1/services/total2bq",
      "uid": "893334ed-4b7d-4854-997c-b8fbe582ef00",
      // ...
      "template": {
        "scaling": {
          "maxInstanceCount": 2
        },
        "serviceAccount": "total2bq-sa@ project id .iam.gserviceaccount.com",
        "containers": [
          {
            "name": "total2bq-1",
            "image": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/total2bq@sha256:e0944d8c43aeaaae5691b61a2a10ca3b272d826f54a2c5291e709f526317a943",
            // ...
            "baseImageUri": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125"
          }
        ],
        "maxInstanceRequestConcurrency": 1
      },
      // ...
      "urls": [
        "https://total2bq- project number .asia-northeast1.run.app",
        "https://total2bq- random string -an.a.run.app"
      ],
      // ...
      "uri": "https://total2bq- random string -an.a.run.app",
      "buildConfig": {
        "name": "projects/ project number /locations/asia-northeast1/builds/d0475ee9-dafa-40fe-95b7-16ca9733903e",
        "sourceLocation": "gs://run-sources- project id -asia-northeast1/services/total2bq/1768658216.718000.zip#1768658217426437",
        "functionTarget": "total2bq",
        "imageUri": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/total2bq",
        "baseImage": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125",
        "enableAutomaticUpdates": true
      },
      "etag": "\"COSrrssGEPCTy-QB/cHJvamVjdHMvbmstaG9tZS1kYXRhL2xvY2F0aW9ucy9hc2lhLW5vcnRoZWFzdDEvc2VydmljZXMvdG90YWwyYnE\""
    },
    {
      "name": "projects/ project id /locations/asia-northeast1/services/pubsub-to-bq",
      "uid": "427aec17-9b5f-44bc-b2a8-22b085970b6f",
      // ...
      "labels": {
        "goog-managed-by": "cloudfunctions",
        "goog-cloudfunctions-runtime": "go122"
      },
      "annotations": {
        "cloudfunctions.googleapis.com/function-id": "pubsub_to_bq"
      },
      // ...
      "client": "cloudfunctions",
      // ...
      "template": {
        // ...
        "annotations": {
          "cloudfunctions.googleapis.com/trigger-type": "HTTP_TRIGGER"
        },
        "scaling": {
          "maxInstanceCount": 2
        },
        "serviceAccount": " project number -compute@developer.gserviceaccount.com",
        "containers": [
          {
            "name": "worker",
            "image": "asia-northeast1-docker.pkg.dev/ project id /gcf-artifacts/pubsub__to__bq:version_1",
            // ...
            "baseImageUri": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/go122"
          }
        ],
        "maxInstanceRequestConcurrency": 1
      },
      // ...
      "urls": [
        "https://pubsub-to-bq- project number .asia-northeast1.run.app",
        "https://asia-northeast1- project id .cloudfunctions.net/pubsub_to_bq",
        "https://pubsub-to-bq- random string -an.a.run.app"
      ],
      // ...
      "uri": "https://pubsub-to-bq- random string -an.a.run.app",
      "customAudiences": [
        "https://asia-northeast1- project id .cloudfunctions.net/pubsub_to_bq"
      ],
      "buildConfig": {
        "name": "projects/ project number /locations/asia-northeast1/builds/7e7fcf21-3346-4697-aed3-ce96c5eb1c25",
        "sourceLocation": "gs://gcf-v2-sources- project number -asia-northeast1/pubsub_to_bq/function-source.zip#1721553313671054",
        "functionTarget": "pubsub_to_bq",
        "imageUri": "asia-northeast1-docker.pkg.dev/ project id /gcf-artifacts/-",
        "baseImage": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/go122",
        "enableAutomaticUpdates": true
      },
      "etag": "\"CI2l87QGENCAh6YB/cHJvamVjdHMvbmstaG9tZS1kYXRhL2xvY2F0aW9ucy9hc2lhLW5vcnRoZWFzdDEvc2VydmljZXMvcHVic3ViLXRvLWJx\""
    }
  ],
  "unreachable": [
    "europe-west15",
    "me-central2",
    "us-central2",
    "us-east7",
    "us-west8"
  ]
}

ということで、pubsub_to_bq (= pubsub-to-bq) は昔私が作成した関数なのですが、これ「だけ」が gcloud functions list で得られる関数です。他の2つは gcloud functions list では得られません。
URL の一部とするために、_- に変換されているのかもしれません。

今の UI はどうなっているか

Cloud Run で関数を作成しようとすると、以下の流れになっています。

  • Services のページから […] Write a function をクリック
  • Create service のページに遷移(Function Use an inline editor to create a function が選択されている)
  • サービスを作成
  • ダミーコンテナ (hello) が作成され、デプロイされる
  • 関数ソースコードを編集して貼り付ける
  • 再デプロイ

おわりに

functions の方の API もそれなりに便利だった気がするのですが、今後サポートが薄くなりそうな気がします。今回は Cloud Run にそのまま乗っかって進んでいこうと思いました。

参考文献


Cloud Functions can no longer be created? Unraveling the mystery of Cloud Run functions

Conclusion

It is no longer possible to create "functions" from the Web UI that can be retrieved with gcloud functions list. However, it is possible to create functions that appear as "functions" within Cloud Run Services.

There is a command called gcloud functions detach, which seemingly allows you to convert a function obtainable via gcloud functions list into one that is not (though I haven’t tried running it).

Trigger

I struggled a bit with the title: "Cloud Functions can no longer be created? Unraveling the mystery of Cloud Run functions" versus "Can you distinguish between these two functions? Unraveling the mystery of Cloud Run functions".

3 seemingly identical functions

Of the three seemingly identical functions in this image, only pubsub-to-bq is a function that can be retrieved with gcloud functions list. The remaining two cannot be obtained with gcloud functions list.

In the past, I had certainly created Cloud Run functions. This time, when I tried to import an existing service into Terraform, I found I couldn’t. When I checked with gcloud functions list, I found that the "function I created a long time ago" was there, but the "function I created recently" was not.
Yes, to reiterate, there are functions that exist on the screen but cannot be obtained with gcloud functions list.

This is the day (2025-02-19)

2025-02-19 The following description appeared in the release notes:

Support for deploying v2 functions in Cloud Run is now in general availability (GA). This lets you customize your function as you would a Cloud Run service. This change removes support for creating, deploying, or updating v2 functions in the Google Cloud console. However, you can still manage functions created with the Cloud Functions v2 API using the Cloud Functions gcloud CLI, the Cloud Functions v2 API, or the Cloud Run Cloud Console. See Cloud Run functions comparison for more details.

Unless you are thinking very carefully, you might have just thought:

  • Oh, the UI has changed.
  • But I can still create functions.
  • Integration seems to have progressed.

And left it at that. Our experience of "creating a function" shouldn’t have changed much:

  • In the Web UI, the UI changed a bit, but it’s possible.
  • With gcloud functions deploy, it works as before.

However, a big change was actually happening behind the scenes.

Digression (History)

  • 2017-03: Cloud Functions (1st gen) Beta
  • 2019-11: Cloud Run GA
  • 2022-02: Cloud Functions (2nd gen) Preview (Cloud Run based)
  • 2024-08: Renamed to "Cloud Run functions", customizable as Run service
  • 2025-02: End of support for creating v2 functions in the console (Full transition to Cloud Run creation flow)

Cloud Functions was originally a serverless function execution environment provided by Google. 2017-03-09 says "Beta release of Google Cloud Functions". 2017-10-19 mentions the release of the v1 API.

2022-02-14 states "Cloud Functions has released Cloud Functions (2nd gen), available at the Preview release level. Cloud Functions (2nd gen) is Google Cloud’s next-generation Functions-as-a-Service offering." This is the arrival of the 2nd generation. This is the first time the string "2nd" appears. 2022-12-13 states "The cloudfunctions.googleapis.com/v2 API now supports reading 1st gen functions, using the get and list methods." This is the first time the string "v2" appears.

2024-08-21 states "You can also deploy new functions, and modify existing functions that were created with the Cloud Functions v2 API in Cloud Run. This enables you to customize your function as you would a Cloud Run service." The relationship with Cloud Run is explicitly stated in the release notes. And it clearly states that 2nd gen functions are Cloud Run services. (This must have been mentioned many times outside of release notes, but since dates are unclear, I am tracking the release notes this time). This is the first time the string "Cloud Run" appears.

Here are the Cloud Run Release Notes. Going back a bit, 2019-10-01 is the first entry in the Cloud Run Release Notes. 2019-11-14 states GA.

2025-02-11 has something interesting written. "Cloud Run functions created with the Cloud Functions (v2) API (cloudfunctions.googleapis.com) can now be detached so that they can only be managed through the Cloud Run Admin API (run.googleapis.com)." So, you can make a function… not a function!? It seems to be an irreversible conversion. 2025-02-19 mentions the "Google Cloud console" (= Web UI) discussed earlier.

So, a little over 2 years after Cloud Run was born [2019-10-01], Cloud Functions 2nd gen appeared [2022-02-14]. The name changed to Cloud Run functions on [2024-08-21], and the release notes say "functions appear as services" (though I recall seeing them before). After that, the function (created with the feeling until now) became a Cloud Run service that is not a function by default [2025-02-19], leading to the present.

Cloud Functions 2nd generation runs on Cloud Run, a container execution environment (service). Although not many articles explicitly state it, it is understood that Cloud Functions 1st generation runs (or ran) on App Engine (or using the same mechanism as App Engine).

Supplement

Managing functions contains the following description:

Note: If you create a Cloud Run functions function using gcloud run commands or the Cloud Run Admin API, you cannot manage that function using gcloud functions commands or the Cloud Functions v2 API.

Here too, it is clearly stated that a mere service is different from a service that appears as a function.

Command and API Responses

Here are some of the command and API responses in a project.

gcloud functions list
NAME          STATE   TRIGGER       REGION           ENVIRONMENT
pubsub_to_bq  ACTIVE  HTTP Trigger  asia-northeast1  2nd gen
gcloud run services list # LAST DEPLOYED BY and part of URL removed
   SERVICE       REGION           URL                                                            LAST DEPLOYED AT
✔  instant2bq    asia-northeast1  https://instant2bq- project number .asia-northeast1.run.app    2026-01-17T14:03:08.591581Z
✔  pubsub-to-bq  asia-northeast1  https://pubsub-to-bq- project number .asia-northeast1.run.app  2024-07-21T09:19:16.329328Z
✔  total2bq      asia-northeast1  https://total2bq- project number .asia-northeast1.run.app      2026-01-17T14:00:12.969052Z

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" https://cloudfunctions.googleapis.com/v2/projects/ project id /locations/-/functions

{
  "functions": [
    {
      "name": "projects/ project id /locations/asia-northeast1/functions/pubsub_to_bq",
      "buildConfig": {
        "build": "projects/ project number /locations/asia-northeast1/builds/7e7fcf21-3346-4697-aed3-ce96c5eb1c25",
        "runtime": "go122",
        "entryPoint": "pubsub_to_bq",
        "source": {
          "storageSource": {
            "bucket": "gcf-v2-sources- project number -asia-northeast1",
            "object": "pubsub_to_bq/function-source.zip",
            "generation": "1721553313671054"
          }
        },
        "dockerRepository": "projects/ project id /locations/asia-northeast1/repositories/gcf-artifacts",
        "sourceProvenance": {
          "resolvedStorageSource": {
            "bucket": "gcf-v2-sources- project number -asia-northeast1",
            "object": "pubsub_to_bq/function-source.zip",
            "generation": "1721553313671054"
          }
        },
        "dockerRegistry": "ARTIFACT_REGISTRY",
        "automaticUpdatePolicy": {}
      },
      "serviceConfig": {
        "service": "projects/ project id /locations/asia-northeast1/services/pubsub-to-bq",
        "timeoutSeconds": 300,
        "environmentVariables": {
          "PROJECT_ID": " project id ",
          "SUBSCRIPTION_ID": "instant_subscription",
          "LOG_EXECUTION_ID": "true"
        },
        "maxInstanceCount": 2,
        "ingressSettings": "ALLOW_ALL",
        "uri": "https://pubsub-to-bq- random string -an.a.run.app",
        "serviceAccountEmail": " project number -compute@developer.gserviceaccount.com",
        "availableMemory": "128Mi",
        "allTrafficOnLatestRevision": true,
        "revision": "pubsub-to-bq-00009-kad",
        "maxInstanceRequestConcurrency": 1,
        "availableCpu": "167m"
      },
      "state": "ACTIVE",
      "updateTime": "2024-07-21T09:19:16.610753517Z",
      "labels": {
        "deployment-tool": "cli-gcloud"
      },
      "environment": "GEN_2",
      "url": "https://asia-northeast1- project id .cloudfunctions.net/pubsub_to_bq",
      "createTime": "2024-07-15T13:12:25.181025243Z",
      "satisfiesPzi": true
    }
  ]
}

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" https://run.googleapis.com/v2/projects/ project id /locations/-/services

{
  "services": [
    {
      "name": "projects/ project id /locations/asia-northeast1/services/instant2bq",
      "uid": "aef5a6c5-ef27-4588-961c-4380699ee9a4",
      // ...
      "template": {
        "scaling": {
          "maxInstanceCount": 1
        },
        "serviceAccount": "instant2bq-sa@ project id .iam.gserviceaccount.com",
        "containers": [
          {
            "name": "instant2bq-1",
            "image": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/instant2bq@sha256:ff99bb1a727a9938ec2f74946d7ae34471c6d971db1ef9e1f300cb820a546d9d",
            // ...
            "baseImageUri": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125"
          }
        ],
        "maxInstanceRequestConcurrency": 1
      },
      // ...
      "urls": [
        "https://instant2bq- project number .asia-northeast1.run.app",
        "https://instant2bq- random string -an.a.run.app"
      ],
      // ...
      "uri": "https://instant2bq- random string -an.a.run.app",
      "buildConfig": {
        "name": "projects/ project number /locations/asia-northeast1/builds/fec8c6a4-dbc8-4c5e-8598-670e90bcb6a1",
        "sourceLocation": "gs://run-sources- project id -asia-northeast1/services/instant2bq/1768658373.776000.zip#1768658374307361",
        "functionTarget": "instant2bq",
        "imageUri": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/instant2bq",
        "baseImage": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125",
        "enableAutomaticUpdates": true
      },
      "etag": "\"CJatrssGEOizzZYB/cHJvamVjdHMvbmstaG9tZS1kYXRhL2xvY2F0aW9ucy9hc2lhLW5vcnRoZWFzdDEvc2VydmljZXMvaW5zdGFudDJicQ\""
    },
    {
      "name": "projects/ project id /locations/asia-northeast1/services/total2bq",
      "uid": "893334ed-4b7d-4854-997c-b8fbe582ef00",
      // ...
      "template": {
        "scaling": {
          "maxInstanceCount": 2
        },
        "serviceAccount": "total2bq-sa@ project id .iam.gserviceaccount.com",
        "containers": [
          {
            "name": "total2bq-1",
            "image": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/total2bq@sha256:e0944d8c43aeaaae5691b61a2a10ca3b272d826f54a2c5291e709f526317a943",
            // ...
            "baseImageUri": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125"
          }
        ],
        "maxInstanceRequestConcurrency": 1
      },
      // ...
      "urls": [
        "https://total2bq- project number .asia-northeast1.run.app",
        "https://total2bq- random string -an.a.run.app"
      ],
      // ...
      "uri": "https://total2bq- random string -an.a.run.app",
      "buildConfig": {
        "name": "projects/ project number /locations/asia-northeast1/builds/d0475ee9-dafa-40fe-95b7-16ca9733903e",
        "sourceLocation": "gs://run-sources- project id -asia-northeast1/services/total2bq/1768658216.718000.zip#1768658217426437",
        "functionTarget": "total2bq",
        "imageUri": "asia-northeast1-docker.pkg.dev/ project id /cloud-run-source-deploy/total2bq",
        "baseImage": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/go125",
        "enableAutomaticUpdates": true
      },
      "etag": "\"COSrrssGEPCTy-QB/cHJvamVjdHMvbmstaG9tZS1kYXRhL2xvY2F0aW9ucy9hc2lhLW5vcnRoZWFzdDEvc2VydmljZXMvdG90YWwyYnE\""
    },
    {
      "name": "projects/ project id /locations/asia-northeast1/services/pubsub-to-bq",
      "uid": "427aec17-9b5f-44bc-b2a8-22b085970b6f",
      // ...
      "labels": {
        "goog-managed-by": "cloudfunctions",
        "goog-cloudfunctions-runtime": "go122"
      },
      "annotations": {
        "cloudfunctions.googleapis.com/function-id": "pubsub_to_bq"
      },
      // ...
      "client": "cloudfunctions",
      // ...
      "template": {
        // ...
        "annotations": {
          "cloudfunctions.googleapis.com/trigger-type": "HTTP_TRIGGER"
        },
        "scaling": {
          "maxInstanceCount": 2
        },
        "serviceAccount": " project number -compute@developer.gserviceaccount.com",
        "containers": [
          {
            "name": "worker",
            "image": "asia-northeast1-docker.pkg.dev/ project id /gcf-artifacts/pubsub__to__bq:version_1",
            // ...
            "baseImageUri": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/go122"
          }
        ],
        "maxInstanceRequestConcurrency": 1
      },
      // ...
      "urls": [
        "https://pubsub-to-bq- project number .asia-northeast1.run.app",
        "https://asia-northeast1- project id .cloudfunctions.net/pubsub_to_bq",
        "https://pubsub-to-bq- random string -an.a.run.app"
      ],
      // ...
      "uri": "https://pubsub-to-bq- random string -an.a.run.app",
      "customAudiences": [
        "https://asia-northeast1- project id .cloudfunctions.net/pubsub_to_bq"
      ],
      "buildConfig": {
        "name": "projects/ project number /locations/asia-northeast1/builds/7e7fcf21-3346-4697-aed3-ce96c5eb1c25",
        "sourceLocation": "gs://gcf-v2-sources- project number -asia-northeast1/pubsub_to_bq/function-source.zip#1721553313671054",
        "functionTarget": "pubsub_to_bq",
        "imageUri": "asia-northeast1-docker.pkg.dev/ project id /gcf-artifacts/-",
        "baseImage": "asia-northeast1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/go122",
        "enableAutomaticUpdates": true
      },
      "etag": "\"CI2l87QGENCAh6YB/cHJvamVjdHMvbmstaG9tZS1kYXRhL2xvY2F0aW9ucy9hc2lhLW5vcnRoZWFzdDEvc2VydmljZXMvcHVic3ViLXRvLWJx\""
    }
  ],
  "unreachable": [
    "europe-west15",
    "me-central2",
    "us-central2",
    "us-east7",
    "us-west8"
  ]
}

So, pubsub_to_bq (= pubsub-to-bq) is a function I created a long time ago, and this is the "only" function obtained with gcloud functions list. The other two cannot be obtained with gcloud functions list.
It might be that _ is converted to - to make it part of the URL.

What is the current UI like?

When you try to create a function in Cloud Run, the flow is as follows:

  • Click […] Write a function from the Services page
  • Transition to the Create service page (Function Use an inline editor to create a function is selected)
  • Create service
  • A dummy container (hello) is created and deployed
  • Edit and paste the function source code
  • Redeploy

Conclusion

I felt that the functions API was reasonably convenient, but I have a feeling that support will become thinner in the future. This time, I decided to just go with Cloud Run.

References

Cloud Run,google cloud

Posted by tako