From 3a1bf23eb598a8a97bf0850b97c6b11c277ffcba Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 16 Jul 2026 21:17:35 +0000 Subject: [PATCH] fix(deployment): raise adapter-node BODY_SIZE_LIMIT for document uploads adapter-node caps request bodies at 512K by default and rejects larger requests with HTTP 413 before they reach the SvelteKit action. Conference base PDF and image uploads exceed this, so uploading a certificate/document template failed on the deployed site even though the Zod schema permits up to 10MB per file. Set BODY_SIZE_LIMIT=64M in the production image and document the variable in .env.example. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_018FeiSjMv4pDn6p81zqPYqP --- .env.example | 8 ++++++++ Dockerfile | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/.env.example b/.env.example index 356e653b..8b1a5356 100644 --- a/.env.example +++ b/.env.example @@ -21,6 +21,14 @@ NODE_ENV=development # [OPTIONAL] Server port (default: 3000) PORT=3000 +# [OPTIONAL] Maximum request body size for the Node server (default: 512K) +# adapter-node rejects larger request bodies with HTTP 413 before they reach the app, +# which silently breaks file uploads (conference base PDFs / images can be several MB; +# the Zod schema validates base PDFs up to 10MB each, and one save may include several). +# Set this above the largest expected upload. Accepts K/M/G suffixes; "Infinity" disables. +# Not enforced by the Vite dev server — only by the production (adapter-node) build. +# BODY_SIZE_LIMIT=64M + # [OPTIONAL] Public origin of the application (e.g. https://delegator.munify.cloud) # SvelteKit uses this for CSRF protection on form submissions and POST requests. # If not set, SvelteKit infers it from the Host header, which works when your reverse diff --git a/Dockerfile b/Dockerfile index 4bdfcc8a..ad40317c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,5 +27,11 @@ RUN bun run build:app && bun run check USER bun ENV NODE_ENV=production +# adapter-node caps request bodies at 512K by default and rejects anything larger with +# HTTP 413 before the request reaches the app. Conference document/image uploads (base +# PDFs are validated up to 10MB each in the Zod schema, and several can be sent in one +# save) exceed that. Raise the limit so uploads actually reach the server. Overridable at +# runtime via the BODY_SIZE_LIMIT env var (see .env.example). +ENV BODY_SIZE_LIMIT=64M EXPOSE 3000/tcp CMD ["sh", "-c", "bunx prisma migrate deploy && bun ./build/index.js"]