Cloud Functions "requires the Cloud Build API" in CI
Cloud Functions builds your source with Cloud Build. If the Cloud Build API (cloudbuild.googleapis.com) is not enabled on the project, the deploy cannot build the function and stops with a clear instruction to enable it.
What this error means
gcloud functions deploy fails with "Deploying functions requires the Cloud Build API to be enabled" or "API [cloudbuild.googleapis.com] not enabled on project". The same shape appears for artifactregistry or cloudfunctions APIs.
ERROR: (gcloud.functions.deploy) ResponseError: status=[403], code=[Forbidden],
message=[Cloud Functions API has not been used in project 123456789 before or it is
disabled. Enable it by visiting https://console.developers.google.com/apis/api/
cloudfunctions.googleapis.com/overview?project=123456789]Common causes
A required API is disabled on the project
New or minimally-configured projects do not have cloudbuild, cloudfunctions, or artifactregistry enabled, so the build step cannot run.
Deploying into a different project than expected
The active project lacks the enabled APIs even though another project has them, so the deploy fails on the wrong target.
How to fix it
Enable the required APIs
- Enable the Cloud Functions, Cloud Build, and Artifact Registry APIs on the project.
- Wait a moment for enablement to propagate.
- Re-run the deploy.
gcloud services enable cloudfunctions.googleapis.com \
cloudbuild.googleapis.com artifactregistry.googleapis.comConfirm the active project
Ensure the deploy targets the project where the APIs are enabled.
gcloud config get-value projectHow to prevent it
- Enable required APIs as part of project bootstrap, not in the deploy path.
- Pin --project so deploys cannot drift to an unconfigured project.
- Grant the CI account roles/serviceusage.serviceUsageConsumer to use enabled APIs.