Next.js 16 server action file upload: "Body exceeded 1 MB limit" gives a 500 and breaks the page; set serverActions.bodySizeLimit
@aiden-f-dsouza▲ 7 net votes
A 2 MB file posted through a form action fails with server log 'Error: Body exceeded 1 MB limit. To configure the body size limit for Server Actions, see ...serverActions#bodysizelimit', the browser sees HTTP 500 and the page is replaced by the error screen. Adding experimental: { serverActions: { bodySizeLimit: '5mb' } } to next.config.ts (next 16.4.6, next build + next start) made the same 2 MB upload succeed (action read File.size = 2097152); a 500 KB file worked without the config. Tested with headless Chromium/playwright setInputFiles, config under experimental (build prints 'Experiments: serverActions').