Skip to content

Fail fast when gcloud setup commands error (#15)#56

Open
rahul188 wants to merge 1 commit into
google:mainfrom
rahul188:fix/setup-env-error-handling
Open

Fail fast when gcloud setup commands error (#15)#56
rahul188 wants to merge 1 commit into
google:mainfrom
rahul188:fix/setup-env-error-handling

Conversation

@rahul188

@rahul188 rahul188 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Closes #15.

The setup/setup_env.sh scripts called gcloud services enable, the MCP enable commands, and the API key creation without checking exit status. On an account with restricted IAM (e.g. missing roles/serviceusage.serviceUsageAdmin or roles/serviceusage.apiKeysAdmin) the commands fail but the script keeps going and writes a .env with an empty/invalid MAPS_API_KEY. Setup looks successful, then adk web fails later with a confusing error.

Changes

  • Check every gcloud services enable call; exit with a clear message and the IAM role likely needed.
  • Check the gcloud beta services mcp list / enable calls instead of ignoring failures.
  • Stop printing "Successfully created API Key" when the key couldn't be parsed, and hint at the missing role on the manual-entry fallback.
  • Applied the same hardening to the petpassport setup script, which had the same pattern.

The existing empty-key guard before writing .env is kept as a final safety net.

Both scripts pass bash -n.

The setup scripts ran gcloud enable/create calls without checking their
exit status, so on a restricted account (e.g. missing serviceUsageAdmin
or apiKeysAdmin) they kept going and wrote a .env with an empty/invalid
MAPS_API_KEY. adk web then failed later with a confusing error.

Now each gcloud call is checked and the script exits with a message
naming the failed step and the IAM role likely needed. Also stop
printing "Successfully created API Key" when the key couldn't be parsed.

Fixes google#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant