Skip to content

Commit

Permalink
fix busboy body size limits in server actions
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Jan 31, 2024
1 parent 9945e87 commit e2a575f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/next/src/server/app-render/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,16 @@ export async function handleAction({

if (isMultipartAction) {
if (isFetchAction) {
const readableLimit = serverActions?.bodySizeLimit ?? '1 MB'
const limit = require('next/dist/compiled/bytes').parse(
readableLimit
)

const busboy = require('busboy')
const bb = busboy({ headers: req.headers })
const bb = busboy({
headers: req.headers,
limits: { fieldSize: limit, fileSize: limit },
})
req.pipe(bb)

bound = await decodeReplyFromBusboy(bb, serverModuleMap)
Expand Down

0 comments on commit e2a575f

Please sign in to comment.