Description
When running the gcloud services enable setup script via line-break backslashes (\), an accidental trailing space at the end of a line (specifically after servicenetworking.googleapis.com \ ) causes the shell interpreter to execute the command prematurely.
This results in a blank service string being sent to the Google Cloud API, triggering a SERVICE_CONFIG_NOT_FOUND_OR_PERMISSION_DENIED error, and causes the subsequent line (aiplatform.googleapis.com) to be evaluated as a standalone bash command (resulting in command not found).
Steps to Reproduce
- Open Cloud Shell in a Google Cloud project.
- Copy and paste the following multi-line command exactly as written (note the trailing space after the backslash on the
servicenetworking line):
gcloud services enable \
alloydb.googleapis.com \
bigquery.googleapis.com \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
iam.googleapis.com \
secretmanager.googleapis.com \
compute.googleapis.com \
servicenetworking.googleapis.com \
aiplatform.googleapis.com
Expected Result
All 10 listed APIs should be enabled successfully.
Actual Result
The command fails with the following errors:
Plaintext
ERROR: (gcloud.services.enable) [...] Not found or permission denied for service(s): .
...
reason: SERVICE_CONFIG_NOT_FOUND_OR_PERMISSION_DENIED
bash: aiplatform.googleapis.com: command not found
Suggested Fix
Update the Codelab/README documentation to use a clean, single-line string for the setup command to eliminate line-break parsing bugs:
Bash
gcloud services enable alloydb.googleapis.com bigquery.googleapis.com run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com iam.googleapis.com secretmanager.googleapis.com compute.googleapis.com servicenetworking.googleapis.com aiplatform.googleapis.com
Description
When running the
gcloud services enablesetup script via line-break backslashes (\), an accidental trailing space at the end of a line (specifically afterservicenetworking.googleapis.com \) causes the shell interpreter to execute the command prematurely.This results in a blank service string being sent to the Google Cloud API, triggering a
SERVICE_CONFIG_NOT_FOUND_OR_PERMISSION_DENIEDerror, and causes the subsequent line (aiplatform.googleapis.com) to be evaluated as a standalone bash command (resulting incommand not found).Steps to Reproduce
servicenetworkingline):