Recently started getting "Error: aborted" randomly #39242
-
So I randomly started getting the following error This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: aborted
at connResetException (node:internal/errors:692:14)
at abortIncoming (node:_http_server:602:17)
at socketOnClose (node:_http_server:596:3)
at Socket.emit (node:events:539:35)
at Socket.emit (node:domain:475:12)
at TCP.<anonymous> (node:net:709:12)
error - unhandledRejection: Error: aborted
at connResetException (node:internal/errors:692:14)
at abortIncoming (node:_http_server:602:17)
at socketOnClose (node:_http_server:596:3)
at Socket.emit (node:events:539:35)
at Socket.emit (node:domain:475:12)
at TCP.<anonymous> (node:net:709:12) {
code: 'ECONNRESET'
} It happens if I make my browser go from mobile view to desktop view using Chrome's DevTools and sometimes it will happen just refreshing the page. The only |
Beta Was this translation helpful? Give feedback.
Replies: 21 comments 24 replies
-
just update next version to canary-9 |
Beta Was this translation helpful? Give feedback.
-
also facing the issue on 13.4.1 |
Beta Was this translation helpful? Give feedback.
-
face the same issue in latest version 13.5 |
Beta Was this translation helpful? Give feedback.
-
Same in 13.5.4 using the app router, but only appears to happen when the request is cancelled but do not occur on GET requests |
Beta Was this translation helpful? Give feedback.
-
I think this is due to the middleware. |
Beta Was this translation helpful? Give feedback.
-
I am also experiencing this with 14.1.0 |
Beta Was this translation helpful? Give feedback.
-
I am having the same issue with 13.5.6 AbortError: The operation was aborted.
at new DOMException (node:internal/per_context/domexception:53:5)
at Object.destroy (node:internal/deps/undici/undici:10767:33)
at httpFetch (node:internal/deps/undici/undici:10563:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async node:internal/deps/undici/undici:10342:20
at async mainFetch (node:internal/deps/undici/undici:10332:20)
```
It happens only sometimes and only on production. |
Beta Was this translation helpful? Give feedback.
-
Following for updates |
Beta Was this translation helpful? Give feedback.
-
Facing the same issue on next 14.1.0 |
Beta Was this translation helpful? Give feedback.
-
experiencing the same issue in next.js v14+ by the way, it's thrown in production env which is deployed as standalone mode |
Beta Was this translation helpful? Give feedback.
-
Facing the same issue in next js 14.2.3 |
Beta Was this translation helpful? Give feedback.
-
Facing the same issue with |
Beta Was this translation helpful? Give feedback.
-
Anyone find solution to this problem? Or wait is causing this error? I'm running local server in Docker image (webServer in playwright config) when running E2E test in CI with Playwright, half of the time tests are failing because server is crashing with "Error: aborted", and needing to be reruned when failing and be prayed to not crash again :) |
Beta Was this translation helpful? Give feedback.
-
any updates on this? not even sure what triggers the issue... |
Beta Was this translation helpful? Give feedback.
-
I'm also getting the error. I'm using middleware to setup CORS: // https://nextjs.org/docs/app/building-your-application/routing/middleware#cors
const corsOptions = {
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization'
}
const corsMiddleware = (request: NextRequest) => {
const origin = '*'
const isAllowedOrigin = true
// Handle preflighted requests
const isPreflight = request.method === 'OPTIONS'
if (isPreflight) {
const preflightHeaders = {
...(isAllowedOrigin && { 'Access-Control-Allow-Origin': origin }),
...corsOptions
}
return NextResponse.json({}, { headers: preflightHeaders })
}
// Handle simple requests
const response = NextResponse.next()
if (isAllowedOrigin) {
response.headers.set('Access-Control-Allow-Origin', origin)
}
Object.entries(corsOptions).forEach(([key, value]) => {
response.headers.set(key, value)
})
return response
} |
Beta Was this translation helpful? Give feedback.
-
Yeah, anything in middleware will throw this error, but i still didn't find the workaround ;/ Maybe someone have better luck. Any chance to take a look @leerob ? |
Beta Was this translation helpful? Give feedback.
-
frankly, my suggestion is not to use next.js any leading-edge technology needs time to mitigate these issues |
Beta Was this translation helpful? Give feedback.
-
I have this issue, the cause is I'm streaming the response from server to client. After the streaming finish, there some tasks need to be done. So adding |
Beta Was this translation helpful? Give feedback.
-
15.0.3 version same issue [22:52:50.823] ERROR (next.js): aborted
err: {
"type": "Error",
"message": "aborted",
"stack":
Error: aborted
at abortIncoming (node:_http_server:794:17)
at socketOnClose (node:_http_server:788:3)
at Socket.emit (node:events:530:35)
at TCP.<anonymous> (node:net:337:12)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
"code": "ECONNRESET"
}
[22:52:50.826] ERROR (next.js): ⨯ uncaughtException:
err: {
"type": "Error",
"message": "aborted",
"stack":
Error: aborted
at abortIncoming (node:_http_server:794:17)
at socketOnClose (node:_http_server:788:3)
at Socket.emit (node:events:530:35)
at TCP.<anonymous> (node:net:337:12)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
"code": "ECONNRESET"
}
[22:52:50.826] ERROR (next.js): ⨯ uncaughtException:
err: {
"type": "Error",
"message": "aborted",
"stack":
Error: aborted
at abortIncoming (node:_http_server:794:17)
at socketOnClose (node:_http_server:788:3)
at Socket.emit (node:events:530:35)
at TCP.<anonymous> (node:net:337:12)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
"code": "ECONNRESET"
}
|
Beta Was this translation helpful? Give feedback.
-
Error: aborted Ctrl+S recreates this issue for me. No infinite loop here though. I'm not sure what's causing fetch to have this issue though. |
Beta Was this translation helpful? Give feedback.
just update next version to canary-9
npm command: npm i [email protected]