Skip to content

fix(website): prevent blank pages after in-place redeployment - #113

Merged
Lucki2g merged 2 commits into
mainfrom
fix/stale-pages-after-redeploy
Oct 7, 2026
Merged

Lucki2g merged 2 commits into
mainfrom
fix/stale-pages-after-redeploy

Conversation

@Bircck

@Bircck Bircck commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Problem

Since the Next.js upgrade to 15.5.27, sites that are redeployed in place (the nightly App Service pipeline) can show a blank white page after a deployment. The browser console shows 404s for /_next/static/chunks/webpack-*.js and "Refused to execute script … MIME type ('text/plain')".

Next.js 15.5.27 (and 16.x) copies prerendered pages to .next/server/route-cache/ the first time they are requested, and serves that copy before the build's own prerendered output. The copy is not keyed by build. A zip deployment only replaces packaged files, so the copies survive the next deployment and app restarts. After the next build, pages such as /login come from the previous build and reference chunk hashes that no longer exist.

Only sites with a page request between two deployments break, so rarely used installations keep working until they are used.

Fix

  • next.config.ts: set experimental.isrFlushToDisk: false, so the incremental cache is no longer written to disk. Pages are still prerendered at build time and cached in memory. Data Model Viewer rebuilds for every metadata refresh, so the on-disk cache gives no benefit.
  • instrumentation.ts: when the Node.js server starts, remove .next/server/route-cache. Without this, sites that are already affected keep serving the stale copies after updating, because existing files are still read.

Validation

Reproduced locally by simulating nightly pipeline runs: production build, packaging the standalone output as in Setup/azure-pipelines-build-jobs.yml, then a zip-deploy-style overwrite that keeps runtime-created files, followed by a restart. Used synthetic sample metadata and Node 22.23.2.

Scenario Result
main, second deployment /login served the first build's HTML. webpack-*.js returned 404 and the page was blank.
Config change only, deployed over an affected site Still blank: the existing route-cache files were served.
This PR, deployed over an affected site Stale cache removed on start. Current build served, all static chunks 200.
This PR, following deployment Current build served. No route cache written. Login and metadata work.
Before (main, after redeploy) After (this PR deployed over the same site)
Before: blank page after redeploy After: login page renders
After: metadata after signing in

Website lint and production build passed (existing warnings only).

Bircck added 2 commits October 6, 2026 16:24
Next.js 15.5.27 copies prerendered pages to .next/server/route-cache at runtime and serves that copy before the build's own output. In-place deployments keep these files, so after the next deployment pages reference static chunks that no longer exist and render blank. Disable writing the incremental cache to disk.
Sites already affected keep serving the stale copies even after the cache stops being written. Delete .next/server/route-cache when the Node.js server starts.

@Lucki2g Lucki2g 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.

Virkede at slette cache direkte via SSH.

@Lucki2g
Lucki2g merged commit 6158baf into main Oct 7, 2026
7 checks passed
@Lucki2g
Lucki2g deleted the fix/stale-pages-after-redeploy branch October 7, 2026 06:47
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.

2 participants