fix: stop Next.js 16.3 from endlessly retrying page prefetches - #1348
fix: stop Next.js 16.3 from endlessly retrying page prefetches#1348ahmadaccino wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: de72c13 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Confirming this against production and against an older adapter line. Two notes that may help scoping, plus a request. I hit this on a live site: deploying next 16.2.6 -> 16.3.1 took a small app from 30-40k Workers requests/day to 329M and 175M on two consecutive days, with R2 Class B reads tracking it roughly 1:1 (details in #1334). Your root-cause description matches what I observed, so thank you for chasing it down. The ast-grep rule matches
|
Summary
Fixes #1334.
playground16to Next.js 16.3.1 and add unit and Worker regression coverage plus a patch changesetRoot cause
@opennextjs/aws@4.1.0only selectedsegmentDatawhenexperimental.prefetchInliningwas falsy. Next.js 16.3 enables that setting by default and normalizes it to an object, so cache interception answeredNext-Router-Segment-Prefetchrequests with the full-page RSC payload instead of the requested segment.Next.js still requests the
/_treeresponse and any outlined segment bundles when inlining is enabled. Because the client never received the segment response or itsx-nextjs-postponed: 2header, it kept requesting the route tree indefinitely. The reproduction generated 3,482 repeated/_treerequests in five seconds.The patch removes only the incorrect prefetch-inlining gate and keeps the existing
segmentDatamembership check. It is scoped to cache-interception builds and fails loudly if the pinned upstream implementation changes. The corresponding upstream report is opennextjs/opennextjs-aws#1212.Validation
pnpm code:checkspnpm test(35 test files, 345 tests)SKIP_NEXT_APP_BUILD=true pnpm --filter playground16 exec playwright test e2e/prefetch.cloudflare.spec.ts -c e2e/playwright.config.ts(1 passed)pnpm --filter playground16 exec playwright test e2e/prefetch.cloudflare.spec.ts -c e2e/playwright.turbopack.config.ts(1 passed)