Manage functions
Functions created using the Cloud Functions v2 API
(for example, by using gcloud functions
, the REST API, or Terraform) can be
managed with the Cloud Run Admin API
as well as the Cloud Functions v2 API. For example, you can update an
existing function using either gcloud functions
or gcloud run
commands:
gcloud functions
gcloud functions deploy FUNCTION_NAME" \
--runtime=nodejs22\
--source= . \
--entry-point=ENTRYPOINT"
--trigger-http
gcloud run
gcloud run deploy FUNCTION_NAME" \
--source= . \
--function="ENTRYPOINT"
--base-image=google-22-full/nodejs22
Detach
The gcloud beta functions detach
command lets you detach a Cloud Functions v2 function from its existing
API environment. After you detach a function, you can only manage it using the
Cloud Run Admin API. You might want to do this if your workloads need to stay
within the run.googleapis.com
API boundary for
Assured Workloads, or to ensure
that your workloads use the Cloud Run SKU.
Prepare your function for detach
When preparing to detach your function, consider the following:
- The detach operation is not reversible.
- The detach operation cannot be applied to Cloud Run functions (1st gen).
- Familiarize yourself with how to deploy functions in Cloud Run using the Google Cloud console, Google Cloud CLI, and Terraform.
- HTTP functions will retain their assigned URLs.
- Triggers attached to event-driven functions will be retained.
- Triggers cannot be managed through the
run.googleapis.com
API directly. Be sure to familiarize yourself with the trigger management guides for Eventarc or Pub/Sub. - Disabling retry on failure
is not a supported feature on Cloud Run.
- During the detach operation, Cloud Run functions modifies the triggers attached to functions configured with no retry on failure, to ensure that the underlying Pub/Sub topic makes a maximum of five delivery attempts. When the detach operation is completed, a dead letter queue topic stores the undelivered messages, which you can retrieve by creating a new subscription to the dead letter queue.
- When a function is successfully detached, a new Cloud Run revision is created. Starting from that revision onwards, the function will be billed using the Cloud Run SKU.
Detach your Function
You can detach your function using the following command:
gcloud beta functions detach FUNCTION_NAME
Replace FUNCTION_NAME with the name of your function.