aws-amplify / aws-amplify/amplify-hosting
SSR (WEB_COMPUTE) build serves a stale/frozen build specification — ignores repo amplify.yml, console Build settings, UpdateApp/UpdateBranch, Reconnect, and branch recreate
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
### Environment
- Amplify Hosting, platform **WEB_COMPUTE** (Next.js - SSR), monorepo (`AMPLIFY_MONOREPO_APP_ROOT=apps/web`)
- Region: `us-east-1`
- App ID: `d13ckekjifghi7` (account details available on request)
### Summary
Every build runs a **stale 2-command `preBuild`**:
```
# Executing command: npm install -g pnpm@10.33.0
# Executing command: pnpm install --frozen-lockfile
```
regardless of the current build specification. The correct, updated spec (which adds a `preBuild` step that authenticates to a **private npm registry** before `pnpm install`) exists in **all** of the following, and the build ignores **every** one:
1. Repository root `amplify.yml` (which the console banner states overrides the console build settings).
2. `aws amplify update-app --build-spec ` — persisted; confirmed via `get-app`.
3. `aws amplify update-branch --build-spec `.
4. Console → **Build settings → Edit → Save** (the console reflects the new spec).
5. Console → App settings → **Reconnect repository**.
6. **Deleting and recreating the branch** — a brand-new branch (job counter reset to `1`) *still* ran the old 2 commands.
`get-app` returns the correct (updated) build spec, yet the build never runs it — the build's *effective* build specification appears **decoupled** from the app/branch/console buildSpec at the **app level**.
### Impact
Because the updated `preBuild` step never runs, `pnpm install` can't authenticate to the private registry (HTTP `401`) and the build fails. Production `main` builds have failed continuously since the private dependency was added.
### Reproduction
1. Update the build spec via any/all of the methods above.
2. Trigger a new build.
3. The build log shows only the old 2 commands, never the updated `preBuild` steps.
Verified across multiple commits, a fresh build after a console Save, and a brand-new branch created via delete + recreate.
### Expected
Builds use the **current** build specification — either the repo `amplify.yml` (per the documented override) or the saved console build settings.
### Ask
How do we force Amplify to re-read/refresh the *effective* build specification for an app + branch? Is there a known caching layer that survives `UpdateApp`, console Save, **Reconnect repository**, *and* branch delete/recreate? Short of recreating the entire app, what clears it?
Contributor guide
Research direction
Start with the repository root amplify.yml and compare it with the build specs returned by AWS CLI get-app, update-app, and update-branch. Inspect a fresh build log after the documented refresh actions. Done means the build consumes the current specification, including the private-registry authentication step, rather than the stale two-command preBuild.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, next.js
- Domain
- ci-cd, cloud, devops
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100