Skip to content

Commit a5c2b33

Browse files
committed
fix(google-vertex): write ADC env vars under env.vars for new config schema
Upstream restructured the top-level config env section into a strict object that only allows shellEnv and vars keys (src/config/zod-schema.root-shape.ts). The onboarding auth flow still wrote GOOGLE_CLOUD_PROJECT/GOOGLE_CLOUD_LOCATION directly under env, so onboarding config validation failed with 'Unrecognized keys' after syncing to latest upstream. Nest the ADC env vars under env.vars so they satisfy the new schema and are picked up by collectConfigEnvVarsByTarget. Update the google-vertex docs config examples and prose to the env.vars shape.
1 parent cec25a7 commit a5c2b33

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

docs/providers/google-vertex.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ After onboarding, your `openclaw.json` will include:
142142
},
143143
},
144144
env: {
145-
GOOGLE_CLOUD_PROJECT: "your-project-id",
146-
GOOGLE_CLOUD_LOCATION: "global",
145+
vars: {
146+
GOOGLE_CLOUD_PROJECT: "your-project-id",
147+
GOOGLE_CLOUD_LOCATION: "global",
148+
},
147149
},
148150
}
149151
```
@@ -159,8 +161,8 @@ After onboarding, your `openclaw.json` will include:
159161

160162
<Note>
161163
Environment variables can be set in your shell, in `openclaw.json` under the
162-
`env` key, or in `~/.openclaw/.env`. When running the Gateway as a systemd
163-
service, use the `env` key in `openclaw.json` since shell exports do not reach
164+
`env.vars` key, or in `~/.openclaw/.env`. When running the Gateway as a systemd
165+
service, use the `env.vars` key in `openclaw.json` since shell exports do not reach
164166
the service process.
165167
</Note>
166168

@@ -184,18 +186,18 @@ Onboarding sets `gemini-3.5-flash` as the default model.
184186
provider. If it does, try running `openclaw onboard --auth-choice google-vertex-adc`
185187
again. For manual configurations, check:
186188

187-
1. `GOOGLE_CLOUD_PROJECT` is set (in env or `openclaw.json` `env` section).
189+
1. `GOOGLE_CLOUD_PROJECT` is set (in env or `openclaw.json` `env.vars` section).
188190
2. On GCE/GKE: the metadata server is reachable.
189191
3. With gcloud CLI: you have run `gcloud auth application-default login`.
190192
4. With a service account: `GOOGLE_APPLICATION_CREDENTIALS` points to a valid JSON key file.
191193

192194
</Accordion>
193195

194196
<Accordion title="Vertex AI requires a project ID">
195-
Set `GOOGLE_CLOUD_PROJECT` in the `env` section of `openclaw.json`:
197+
Set `GOOGLE_CLOUD_PROJECT` in the `env.vars` section of `openclaw.json`:
196198

197199
```json5
198-
{ env: { GOOGLE_CLOUD_PROJECT: "your-project-id" } }
200+
{ env: { vars: { GOOGLE_CLOUD_PROJECT: "your-project-id" } } }
199201
```
200202

201203
Then restart the gateway: `openclaw gateway restart` or
@@ -217,7 +219,7 @@ Onboarding sets `gemini-3.5-flash` as the default model.
217219
specific region (e.g. `us-central1`), try switching to `global`:
218220

219221
```json5
220-
{ env: { GOOGLE_CLOUD_LOCATION: "global" } }
222+
{ env: { vars: { GOOGLE_CLOUD_LOCATION: "global" } } }
221223
```
222224

223225
</Accordion>

extensions/google/provider-contract-api.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ export function createGoogleVertexProvider(): ProviderPlugin {
126126
: [...existingModels, { id: defaultModelId, name: "Gemini 3.5 Flash" }];
127127
return {
128128
env: {
129-
GOOGLE_CLOUD_PROJECT: project,
130-
GOOGLE_CLOUD_LOCATION: location,
129+
vars: {
130+
GOOGLE_CLOUD_PROJECT: project,
131+
GOOGLE_CLOUD_LOCATION: location,
132+
},
131133
},
132134
models: {
133135
providers: {

0 commit comments

Comments
 (0)