cloudflare / cloudflare/vinext

[nextjs-tracker] next/image: complete internal fetch after requester disconnects

Open
#3,227 0 comments 0 reactions 0 assignees View on GitHub
nextjs-tracking
Dominant language
TypeScript
Stars
8.8k
Forks
406
Avg merge
2d 6h
Merged PRs (30d)
120

Description

## Next.js Change

**Commit:** [`dcbfff7`](https://github.com/vercel/next.js/commit/dcbfff7789b84f39388228e6dab11456c446e269)
**PR:** [#98168](https://github.com/vercel/next.js/pull/98168)

## What changed

When Next.js optimizes a local image, it internally dispatches a request through the application handler. The internal request retains the client socket for request metadata, but the internal response now uses a separate socket-less mock. Reusing the disconnected client socket caused static-file streaming to consider the internal response finished, leaving the shared image-cache entry pending until process restart.

## Impact on vinext

Where vinext resolves local `next/image` sources through its Node application handler, internal image-response lifecycle must be independent of the requester connection. A client disconnect must not stall optimization or poison/coalesce the image cache for later requests.

## Acceptance criteria

- [ ] Keep client socket data available to the internal request only when needed for request metadata.
- [ ] Ensure the internal image response is not associated with the requester socket.
- [ ] A disconnected requester must not prevent a local static image fetch from settling.
- [ ] A later request for the same optimized image must not remain pending because an earlier requester disconnected.
- [ ] Add Node-server regression coverage with a non-writable requester socket and a streamed local image.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Next.js commit dcbfff7 and PR #98168, then trace how vinext resolves local next/image sources through its Node application handler. Add Node-server regression coverage using a non-writable requester socket and a streamed local image; done means the disconnected request settles and a later request for the same optimized image does not remain pending.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, node.js, typescript
Domain
backend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.