Right, bodySizeLimit is Next's limit, but Vercel functions have their own request body limit of 4.5MB that you can't raise. So files shouldn't go through your function at all.
Upload straight from the browser to storage with a signed URL:
- Server action creates a signed upload URL (Supabase
createSignedUploadUrl, S3 presigned PUT, Vercel Blob client uploads, whatever you use). - Browser uploads the file directly to that URL.
- Browser calls a second action with just the path to save the record.
Your function only handles tiny JSON, and uploads can be as big as your storage allows.