Skip to content

ci(ag-ui): bake GOOGLE_MAPS_API_KEY + Map ID into the demo deploy build#748

Merged
blove merged 1 commit into
mainfrom
ci/ag-ui-demo-maps-key
Jul 6, 2026
Merged

ci(ag-ui): bake GOOGLE_MAPS_API_KEY + Map ID into the demo deploy build#748
blove merged 1 commit into
mainfrom
ci/ag-ui-demo-maps-key

Conversation

@blove

@blove blove commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

The App-mode map cockpit (#747) is invisible on the deployed demo: the ag-ui-demo-deploy job builds with no Maps env, so inject-env bakes an empty key into the bundle — verified against prod (ag-ui.threadplane.ai main-*.js ships googleMaps:""), which disables the App-mode toggle.

This passes GOOGLE_MAPS_API_KEY (new repo secret) and the non-secret Map ID (86d464ea7d5306034fe2a254) to the assemble step.

Required follow-ups (not in this PR)

  1. Add the repo secret (owner action): gh secret set GOOGLE_MAPS_API_KEY with the key from the root .env.
  2. Re-add HTTP-referrer restrictions on the key in Google Cloud console (they were removed during local debugging): https://ag-ui.threadplane.ai/* + http://localhost:*. The key ships in the public bundle, so referrer restriction is the security boundary.
  3. Rollout: the deploy job only fires when examples/ag-ui/** changes — the next ag-ui PR to land (e.g. feat(ag-ui): context-aware welcome suggestions (App mode leads with itinerary prompts) #746) will roll the key-enabled bundle out.

🤖 Generated with Claude Code

The ag-ui demo deploy built with no Maps env, so inject-env wrote an empty
key into the bundle (verified: prod ships googleMaps:"") and the App-mode
map cockpit is disabled on ag-ui.threadplane.ai. Pass the key from the
GOOGLE_MAPS_API_KEY repo secret and inline the (non-secret) Map ID at the
assemble step so the SPA builds key-enabled.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@blove blove enabled auto-merge (squash) July 6, 2026 15:05
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jul 6, 2026 3:08pm

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 1m 31s —— View job


PR Review

  • Gather context
  • Read CI workflow diff
  • Review for security, correctness, and workflow injection issues
  • Post findings

This change is correct. The 7-line diff does exactly what it says: scopes GOOGLE_MAPS_API_KEY and GOOGLE_MAPS_MAP_ID as env vars on the build step so that inject-env.mjs can bake them into the Angular production bundle.

Here's the full chain I verified:

  1. CI env:process.env — the vars are on the run: npx tsx scripts/assemble-ag-ui-demo.ts step, so they're available to every child process it spawns.
  2. assemble script → nx buildassemble-ag-ui-demo.ts:49 runs npx nx build examples-ag-ui-angular --configuration=production --skip-nx-cache.
  3. nx build → inject-env dependencyproject.json lists inject-env as a dependsOn target for the production build.
  4. inject-env reads process.envinject-env.mjs:21 merges .env file (absent in CI) with process.env; your new vars win.
  5. bakes into bundle — writes generated-keys.local.ts which Angular swaps in via fileReplacements.

--skip-nx-cache on the build call ensures inject-env always re-runs and never returns a stale cached empty key.

No issues found:

  • No script injection risk. ${{ secrets.GOOGLE_MAPS_API_KEY }} is in an env: block, not interpolated into a shell script, so GitHub Actions handles masking and escaping safely.
  • Map ID hardcoded correctly. 86d464ea7d5306034fe2a254 is a non-secret Map ID; storing it in a repo secret would be unnecessary. The comment documents this explicitly.
  • Env scoped to the right step. The Vercel deploy step only consumes prebuilt artifacts and doesn't need these vars.

One thing to be aware of (already documented in the PR body): if the GOOGLE_MAPS_API_KEY repo secret hasn't been added before the next deploy fires, inject-env will silently bake an empty key — same as the current broken state. The follow-up secret-add is load-bearing for this to actually work.

@blove blove merged commit b1332d2 into main Jul 6, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant