You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the generated Maps key file replacement to the AG-UI Angular production build.
This makes the inject-env output participate in production bundles, not only development bundles.
Root cause
The deploy workflow set GOOGLE_MAPS_API_KEY and ran inject-env, but the Angular production configuration did not replace the committed generated-keys.ts stub with generated-keys.local.ts. As a result, production deployed a keyless bundle even when the secret was available.
Validation
Before the fix: dummy-key production build ran inject-env with key length 29, but the output bundle still had key length 0.
After the fix: GOOGLE_MAPS_API_KEY=DUMMY_MAPS_KEY_FOR_BUILD_TEST GOOGLE_MAPS_MAP_ID=DUMMY_MAP_ID_FOR_BUILD_TEST npx nx build examples-ag-ui-angular --configuration=production --skip-nx-cache, then checked output bundle key length 29 and Map ID set.
The fix is correct and minimal. Here's what I verified:
Root cause was real. The development configuration in project.json already had the fileReplacements entry (lines 68–76 of the current file), but production was missing it. inject-env.mjs ran (via dependsOn) and wrote generated-keys.local.ts, but the Angular production bundler kept using the committed stub (generated-keys.ts) with empty keys.
The fix is safe in all build scenarios.inject-env.mjs always writes generated-keys.local.ts — even when GOOGLE_MAPS_API_KEY is absent it writes an empty-key file. Since inject-env is in dependsOn at the target level (not configuration-specific), it runs before every build variant. The with file will always exist at the time the bundler needs it.
Path alignment is correct.inject-env.mjs resolves the output to examples/ag-ui/angular/src/environments/generated-keys.local.ts, which matches the with value in the new fileReplacements block exactly.
No issues found. The PR does precisely what it says, is well-validated in the description, and doesn't touch any shared library surface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inject-envoutput participate in production bundles, not only development bundles.Root cause
The deploy workflow set
GOOGLE_MAPS_API_KEYand raninject-env, but the Angular production configuration did not replace the committedgenerated-keys.tsstub withgenerated-keys.local.ts. As a result, production deployed a keyless bundle even when the secret was available.Validation
inject-envwith key length 29, but the output bundle still had key length 0.GOOGLE_MAPS_API_KEY=DUMMY_MAPS_KEY_FOR_BUILD_TEST GOOGLE_MAPS_MAP_ID=DUMMY_MAP_ID_FOR_BUILD_TEST npx nx build examples-ag-ui-angular --configuration=production --skip-nx-cache, then checked output bundle key length 29 and Map ID set.npx nx lint examples-ag-ui-angular(0 errors; existing warnings remain).