`use cache`: stale regeneration started during streaming is not kept alive by `waitUntil` and is cut off on Vercel (16.3)
Link to the code that reproduces this issue
https://github.com/WONJUNE-LEE/next-use-cache-waituntil-repro
To Reproduce
- Deploy the repro to Vercel (Node.js runtime, Fluid compute). It has
cacheComponents: trueand one page,app/p/[id]/page.js: inside<Suspense>, a child doesawait params(so it renders at request time) and then awaitsgetData(), a"use cache: remote"function withcacheLife("minutes")that makes 10 sequentialfetchcalls and logs each step. - Request
/p/1(fills the entry). - Wait more than 60 seconds (stale, not expired) and request
/p/10— the stale value is served and a background regeneration starts. - Wait ~30 seconds and request
/p/11. Repeat 3–4 a couple of times. - Read the function logs for
[repro]lines.
Current vs. Expected behavior
Expected: every background regeneration runs to completion (fetch 10/10 ok → done) and its result is written to the cache handler, kept alive with waitUntil.
Current (16.3.6): the regeneration does not finish within the invocation that started it. It only advances while a later request is running on the same instance, and eventually fails. Observed on a Vercel preview deployment (UTC, each line attached to the request that was running at that moment):
21:03:07 /p/1 PRERENDER resuming regeneration 2w82jd start … fetch 10/10 ok … done (first fill, inside the render)
21:04:28 /p/10 HIT resuming regeneration 4m4v0e start 21:04:29.207Z (stale read → background regeneration)
21:05:01 /p/11 HIT resuming regeneration 4m4v0e fetch 1/10 ok · fetch 2/10 ok
21:06:21 /p/20 HIT resuming regeneration 4m4v0e fetch 3/10 ok · fetch 4/10 ok
21:06:56 /p/21 HIT resuming regeneration 4m4v0e FAILED 21:06:57.604Z TypeError: fetch failed
21:08:15 /p/30 HIT resuming regeneration ghku0q FAILED 21:08:15.767Z TypeError: fetch failedNone of the five background regenerations started after the first fill reached done. Their logs show up under unrelated requests. In a larger production app (Supabase client) the same pattern surfaced as AbortError: This operation was aborted; on 16.2.9 the same app logged none of these failures over ~30 hours, and they started within minutes of deploying 16.3.6.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.4.0
Binaries:
Node: 24.17.0
pnpm: 11.13.1
Relevant Packages:
next: 16.3.6 // Latest available version is detected (16.3.6).
react: 19.3.0
react-dom: 19.3.0
Next.js Config:
output: N/ADeployed on Vercel (Node.js 24, Fluid compute).
Which area(s) are affected? (Select all that apply)
Use Cache, cacheComponents, Partial Prerendering (PPR), Loading UI and Streaming
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
Cause, as far as I can tell (16.3.6 dist, same structure on canary as of 2026-09-28):
- #92636 changed the stale path in
use-cache-wrapperfromawait generateCacheEntry(...)to a detached promise that is only pushed toworkStore.pendingRevalidateWrites. - For a streaming render,
app-rendercallsexecuteRevalidates(workStore)right afterrenderToStreamreturns, andexecuteRevalidatescopies the currentpendingRevalidateWritesinto the promise it hands towaitUntil. - Anything pushed later — the regeneration itself, the
saveToCacheHandlerwrite (combinedSetPromise) and the tiered-handler sync — comes from a"use cache"read inside a Suspense boundary that resolves during streaming, so it is never registered withwaitUntil. (tiered-cache-handlereven says the sync is registered "so it is awaited rather than left untracked".) next startdoes not show it (the process keeps running), which is probably why the e2e test for #92636 passes.
Workaround we are running (pnpm patch): after each workStore.pendingRevalidateWrites.push(x) in use-cache-wrapper.js and tiered-cache-handler.js, also call workStore.afterContext?.waitUntil?.(x.catch(() => {})). With identical diagnostic logging on two preview deployments of our app, unpatched showed 11 aborted reads and 6 degraded renders over four stale cycles; patched showed 0 and 0. A fix in executeRevalidates (keep draining writes added until the stream has finished) would probably be cleaner.
Source: vercel/next.js