AWS test CD baked localhost SITE_URL into Lambda
Symptom
Live portfolio-test HTML advertises runtimeConfig.public.siteUrl (and og/canonical) as http://localhost:4200 while the app is served from https://….execute-api.us-west-2.amazonaws.com.
Cause
cd-aws.yml passed SITE_URL: $. When GitHub Environment test left SITE_URL unset, SAM parameter SiteUrl (Lambda SITE_URL / NUXT_PUBLIC_SITE_URL) became localhost. buildSamParameterOverrides('test') also defaulted to the same localhost value and only enforced HTTPS for production.
Local npm run e2e:regression never hits execute-api + Lambda env, so it stayed green.
Fix
- Resolve a public HTTPS origin before build/deploy (
ensureCdSiteUrlEnv): prefer EnvironmentSITE_URL, else stack outputHttpApiUrlfortest; fail closed otherwise. - Remove the workflow localhost fallback; post-deploy smoke rejects HTML that still contains localhost
siteUrl/ og URLs and requiressiteUrlto matchHttpApiUrl. - Prefer setting Environment
testvarSITE_URLto the stackHttpApiUrlso builds do not depend on a prior stack read.
Prevention
scripts/sam-deploy-flow.test.mjsandscripts/cicd-workflow-policy.test.mjsguard the contract.- Docs:
docs/cicd.md— test EnvironmentSITE_URLrow. - Cursor rule (always on):
.cursor/rules/aws-site-url.mdc— public HTTPS only; no localhost fallback; fail closed; smoke; report immediately. - Verify rule:
.cursor/rules/full-review-verify-test.mdc— report every defect immediately; local e2e ≠ AWS topology; check deployedsiteUrl/ canonical are public HTTPS. - CD skill:
.cursor/rules/portfolio-aws-cicd.mdc+.agents/skills/portfolio-aws-cicd/.