Open nvh3011 opened 1 year ago
is this similar? https://github.com/vercel/next.js/issues/49623
Hi @masterkain I believe the error showed similarities, but there are differences in how it is reproduced. Even I increase RAM, it is not solved
I figure out the error throw randomly after running params.request.body.finalize()
.
ref: https://github.com/vercel/next.js/blob/7adb273b02404949784f9211438e1d5d32e3b6ee/packages/next/src/server/web/sandbox/sandbox.ts#L113
@nvh3011 did you ever find a solution for this? I think I'm seeing a similar problem.
@nvh3011 I faced this issue after upgrading from version 12.3.0 to 12.3.4.
Hi, I only work around with:
Still happening, nextjs 12.1
Edit by maintainers: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Same here:
From: https://github.com/vercel/next.js/issues/56529#issuecomment-2081606279
When I use the middleware CORS example from the docs, I get the following error, even the request completes/succeeds.
Using Next 14.2.3.
Error:
Error: aborted at abortIncoming (node:_http_server:794:17) at socketOnClose (node:_http_server:788:3) at Socket.emit (node:events:531:35) at TCP.<anonymous> (node:net:337:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNRESET' } ⨯ uncaughtException: Error: aborted at abortIncoming (node:_http_server:794:17) at socketOnClose (node:_http_server:788:3) at Socket.emit (node:events:531:35) at TCP.<anonymous> (node:net:337:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNRESET' } ⨯ uncaughtException: Error: aborted at abortIncoming (node:_http_server:794:17) at socketOnClose (node:_http_server:788:3) at Socket.emit (node:events:531:35) at TCP.<anonymous> (node:net:337:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNRESET'
Middleware (using it as stated in the docs):
import { NextRequest, NextResponse } from 'next/server' const allowedOrigins = ['https://acme.com', 'https://my-app.org'] const corsOptions = { 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type, Authorization', } export function middleware(request: NextRequest) { // Check the origin from the request const origin = request.headers.get('origin') ?? '' const isAllowedOrigin = allowedOrigins.includes(origin) // 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 } export const config = { matcher: '/api/:path*', }
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue
/
To Reproduce
Set up nginx and run with config:
middleware.js
file inside/src
export async function middleware(req, event) { console.log(
[*] Request new: ${req.url}
); return NextResponse.next(); }npm run build
npm run start
Error: aborted
Describe the Bug
error_page 404 /not_found
).error_page 404 /not_found
.next start
.Expected Behavior
Nextjs should not throw the uncaughtException
Which browser are you using? (if relevant)
Chrome 112.0.5615.137
How are you deploying your application? (if relevant)
using custom server and local