AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Client-Side Navigation From Homepage To Pricing Crashes With Uncaught ChunkLoadError Due To Cross-Deployment Chunk Caching

Clicking Pricing in the nav from the homepage causes a full app crash (black page) because of a ChunkLoadError. The root cause is two Next.js apps (www and docs) sharing the same origin but having different deployment IDs, causing prefetched docs chunks to be requested from the wrong asset prefix. Webpack caches the chunk rejection, and when the Pricing route later requests the same shared chunk ID, the cached failure is replayed, leading to an uncaught error. The global-error chunk also 404s, preventing any error UI.

highConfidence 95%Next.js

Origin Analysis

Multiple Next.js apps (www and docs) are served from the same origin but deployed separately with distinct asset prefixes and deployment IDs. The www router treats /docs/* links as internal routes and prefetches them, but the returned RSC payload references docs build chunk filenames. These filenames are resolved against the www asset prefix, resulting in 404s. Webpack caches these failed chunk loads. Later, when the Pricing route requires a chunk with the same ID (2896), the cached rejection is replayed, throwing an uncaught ChunkLoadError. The global-error chunk is also requested with the wrong deployment ID and 404s, causing a blank page.
1. Open https://supabase.com, hard reload to clear cache. 2. Wait around 10 seconds for Link prefetches to run (console will log 'Failed to fetch RSC payload' for /docs/guides/*). 3. Click Pricing in the nav. Observe the page goes black with an uncaught ChunkLoadError: Loading chunk 2896 failed.

Fixing Code Block

Edge Case Audit

Disabling prefetch for docs links may slightly reduce perceived performance for users navigating to docs (but since docs is a separate app, full browser navigation is expected anyway). Using plain <a> tags removes SPA transition benefits completely. Ensure that all docs links are covered; missing one can still cause the issue. This fix does not address the underlying global-error 404 problem: any other client-side error on the www app may still result in a blank page because the global-error chunk is fetched with the wrong deployment ID. Recommend separately fixing global-error loading (e.g., ensure correct static asset resolution or inline a minimal error handler). Rollback: if this change causes unexpected behavior, revert to original Link components and instead implement proper asset prefix isolation between the two Next.js apps (e.g., different basePath or assetPrefix configuration per deployment).

Ecosystem Topology