Fix nightly build: invalidate Docker Next.js cache on dependency changes#8000
Merged
gilluminate merged 2 commits intomainfrom Apr 22, 2026
Merged
Fix nightly build: invalidate Docker Next.js cache on dependency changes#8000gilluminate merged 2 commits intomainfrom
gilluminate merged 2 commits intomainfrom
Conversation
The .next/cache and node_modules/.cache Docker mounts persisted stale webpack artifacts after the Turbopack switch (#7956), causing the nightly build to serve HTML instead of JS chunks (blank page with "Unexpected token '<'" console error). Hash package-lock.json on each build and clear the caches when the hash changes. Also mark #7907 and #7956 changelog entries as high-risk. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
nrxsmith
approved these changes
Apr 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (84.96%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8000 +/- ##
==========================================
- Coverage 84.97% 84.96% -0.01%
==========================================
Files 631 631
Lines 41238 41238
Branches 4787 4787
==========================================
- Hits 35040 35039 -1
Misses 5113 5113
- Partials 1085 1086 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ticket: N/A (hotfix for nightly build breakage)
Description Of Changes
The nightly build started serving a blank page after #7956 (webpack → Turbopack switch) merged. The browser console showed
Uncaught SyntaxError: Unexpected token '<'on JS chunk requests — the backend's catch-all route was returningindex.htmlinstead of the chunk file because the chunk hashes in the HTML didn't match what was on disk.Root cause: The Docker build uses
--mount=type=cachefor.next/cacheandnode_modules/.cache. After the bundler switch, stale webpack cache artifacts persisted across builds, producing an inconsistent output where HTML referenced chunk hashes that Turbopack never emitted.Fix: Hash
package-lock.jsonat build time and store it in the cache mount. On subsequent builds, if the hash differs (dependency upgrade, bundler change, etc.), the cache is cleared before the Next.js build runs. This covers.next/cachefor both admin-ui and privacy-center, andnode_modules/.cache(Turbo/eslint).Also retroactively marks #7907 (Next.js 14→16) and #7956 (Turbopack switch) changelog entries as
high-risk.Code Changes
Dockerfile— addedpackage-lock.jsonhash check before each Next.js build step; clears.next/cacheandnode_modules/.cachewhen the hash changeschangelog/7907-upgrade-nextjs-14-to-16.yaml— addedhigh-risklabelchangelog/7956-drop-palette-sass-export.yaml— fixed truncated description, addedhigh-risklabelSteps to Confirm
Build the
built_frontendDocker stage:docker buildx build --target built_frontend --progress=plain -f Dockerfile .Expected: build succeeds, logs show
Invalidating Next.js cache (lock hash changed to: ...)on first runRebuild without changing
package-lock.json:docker buildx build --target built_frontend --progress=plain -f Dockerfile .Expected: layer is cached (fast), or if forced to re-run, logs show
Next.js cache valid (lock hash: ...)Pre-Merge Checklist
CHANGELOG.mdupdated