Next.js v15.5.2 fails with "Response body object should not be disturbed or locked" when using Node.js middleware with large request bodies (>350MB).
npm install
npm run dev
# Test with large file (triggers bug)
chmod +x test.sh
./test.sh 500- ✅ Small files (<350MB): Work fine
- ❌ Large files (>350MB): 500 error with undici exception
middleware.ts- Node.js runtime middleware (required to trigger bug)app/api/upload/route.ts- API endpoint that reads request bodytest.sh- Script to test with different file sizes
- Next.js: 15.5.2
- Runtime: Node.js middleware (bug does not occur with edge runtime)