Skip to content

platformshape/nextjs-body-bug-repro

Repository files navigation

Next.js Body Cloning Bug Reproduction

Issue

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).

Quick Reproduction

npm install
npm run dev

# Test with large file (triggers bug)
chmod +x test.sh
./test.sh 500

Expected vs Actual

  • ✅ Small files (<350MB): Work fine
  • ❌ Large files (>350MB): 500 error with undici exception

Key Files

  • middleware.ts - Node.js runtime middleware (required to trigger bug)
  • app/api/upload/route.ts - API endpoint that reads request body
  • test.sh - Script to test with different file sizes

Environment

  • Next.js: 15.5.2
  • Runtime: Node.js middleware (bug does not occur with edge runtime)

About

Reproduction for node.js middleware issue on next.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published