fix(pdf-compress): use arrayBuffer() instead of formData() for large files

formData() fails with "Failed to parse body as FormData" on large PDFs
in Next.js route handlers. Switch to req.arrayBuffer() which reliably
reads the full body, then manually extract the PDF from multipart.

Extreme mode: arrayBuffer + multipart extraction + GS + qpdf pipeline.
Stirling mode: arrayBuffer forwarding to Stirling with proper headers.

Revert serverActions.bodySizeLimit (doesn't apply to route handlers).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-13 16:32:05 +02:00
parent 194ddf0849
commit 9e73dc3cb9
3 changed files with 86 additions and 56 deletions
-5
View File
@@ -2,11 +2,6 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: 'standalone',
experimental: {
serverActions: {
bodySizeLimit: '250mb',
},
},
};
export default nextConfig;