-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Closed
Labels
ConnectionRelated to the connection() function.Related to the connection() function.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked
Description
Link to the code that reproduces this issue
https://github.com/acrognale/vercel-next-abort-repro
To Reproduce
I've included a standard Next app in the repository that you can start with npm run dev.
Current vs. Expected behavior
When running locally, the request properly aborts. Here is the expected server output:
▲ Next.js 15.2.4 (Turbopack)
- Local: http://localhost:3000
- Network: http://192.168.128.250:3000
✓ Starting...
✓ Ready in 533ms
○ Compiling / ...
✓ Compiled / in 744ms
GET / 200 in 860ms
✓ Compiled /favicon.ico in 145ms
GET /favicon.ico?favicon.45db1c09.ico 200 in 169ms
✓ Compiled /api/stream in 125ms
count: 1
count: 2
GET /api/stream 200 in 2738ms
abort
and on the frontend:
Message 1 at 2025-04-03T16:52:59.275Z
Message 2 at 2025-04-03T16:53:00.276Z
Stream was cancelled!
But when running on Vercel under the Node Runtime, we receive the following:
server:
count: 1
count: 2
count: 3
count: 4
count: 5
count: 6
count: 7
count: 8
count: 9
(and then the function times out because the max duration is 10s.
On the frontend:
Message 1 at 2025-04-03T16:55:04.790Z
Message 2 at 2025-04-03T16:55:05.790Z
Stream was cancelled!
So while the browser is canceling the request, the function on the Node Runtime continues to stream.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:06:57 PDT 2024; root:xnu-11215.41.3~3/RELEASE_ARM64_T6041
Available memory (MB): 36864
Available CPU cores: 14
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: 1.22.22
pnpm: 10.6.5
Relevant Packages:
next: 15.2.4 // Latest available version is detected (15.2.4).
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.2
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Connection
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response
tuliren, drekle, alkymst and cadecannondforsythtuliren, drekle, alkymst and cadecannon
Metadata
Metadata
Assignees
Labels
ConnectionRelated to the connection() function.Related to the connection() function.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked