diff --git a/infrastructure/evault-core/src/core/protocol/graphql-server.ts b/infrastructure/evault-core/src/core/protocol/graphql-server.ts index a8faa752c..f54e059ab 100644 --- a/infrastructure/evault-core/src/core/protocol/graphql-server.ts +++ b/infrastructure/evault-core/src/core/protocol/graphql-server.ts @@ -1339,13 +1339,14 @@ export class GraphQLServer { const buffer = Buffer.from(base64, "base64"); - const MAX_FILE_BYTES = 50 * 1024 * 1024; // 50 MB + const MAX_FILE_BYTES = 250 * 1024 * 1024; // 250 MB if (buffer.length > MAX_FILE_BYTES) { + const maxMb = Math.round(MAX_FILE_BYTES / (1024 * 1024)); return { errors: [ { field: "content", - message: "File exceeds the 50 MB upload limit", + message: `File exceeds the ${maxMb} MB upload limit`, code: "FILE_TOO_LARGE", }, ], diff --git a/infrastructure/evault-core/src/index.ts b/infrastructure/evault-core/src/index.ts index 9cb085d9a..483042feb 100644 --- a/infrastructure/evault-core/src/index.ts +++ b/infrastructure/evault-core/src/index.ts @@ -177,7 +177,11 @@ const initializeEVault = async ( fastifyServer = fastify({ logger: true, - bodyLimit: 20 * 1024 * 1024, // 20MB (default is 1MB; needed for createMetaEnvelope etc.) + // 350MB. Files are uploaded base64-encoded inside the GraphQL JSON body, + // which inflates the raw request ~1.37x, so the body limit must exceed the + // base64-encoded size of the largest allowed file (250MB binary ≈ 343MB + // base64 + JSON overhead). Keep in sync with MAX_FILE_BYTES in graphql-server.ts. + bodyLimit: 350 * 1024 * 1024, }); // Register CORS plugin with relaxed settings diff --git a/infrastructure/evault-core/src/test-utils/e2e-setup.ts b/infrastructure/evault-core/src/test-utils/e2e-setup.ts index 42efb8f69..2cfa848e5 100644 --- a/infrastructure/evault-core/src/test-utils/e2e-setup.ts +++ b/infrastructure/evault-core/src/test-utils/e2e-setup.ts @@ -151,7 +151,7 @@ export async function setupE2ETestServer( // Setup Fastify server const fastifyServer = fastify({ logger: false, - bodyLimit: 20 * 1024 * 1024, // 20MB, match production limit + bodyLimit: 350 * 1024 * 1024, // 350MB, match production limit }); await registerHttpRoutes(fastifyServer, evaultInstance, provisioningService, dbService); diff --git a/platforms/esigner/api/src/controllers/FileController.ts b/platforms/esigner/api/src/controllers/FileController.ts index c44439996..a224e43fa 100644 --- a/platforms/esigner/api/src/controllers/FileController.ts +++ b/platforms/esigner/api/src/controllers/FileController.ts @@ -3,7 +3,7 @@ import { FileService, ReservedFileNameError } from "../services/FileService"; import multer from "multer"; import { v4 as uuidv4 } from "uuid"; -export const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB limit +export const MAX_FILE_SIZE = 250 * 1024 * 1024; // 250MB limit const upload = multer({ limits: { fileSize: MAX_FILE_SIZE }, diff --git a/platforms/esigner/api/src/index.ts b/platforms/esigner/api/src/index.ts index 2ff0acd39..7eb500988 100644 --- a/platforms/esigner/api/src/index.ts +++ b/platforms/esigner/api/src/index.ts @@ -62,8 +62,8 @@ app.use( credentials: true, }), ); -app.use(express.json({ limit: "20mb" })); -app.use(express.urlencoded({ limit: "20mb", extended: true })); +app.use(express.json({ limit: "250mb" })); +app.use(express.urlencoded({ limit: "250mb", extended: true })); // Controllers const authController = new AuthController(); diff --git a/platforms/esigner/client/src/lib/stores/files.ts b/platforms/esigner/client/src/lib/stores/files.ts index 4b770553a..f545b3dc8 100644 --- a/platforms/esigner/client/src/lib/stores/files.ts +++ b/platforms/esigner/client/src/lib/stores/files.ts @@ -68,7 +68,7 @@ export const fetchDocuments = async () => { // Keep fetchFiles alias for backward compatibility export const fetchFiles = fetchDocuments; -const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB limit +const MAX_FILE_SIZE = 250 * 1024 * 1024; // 250MB limit export class FileSizeError extends Error { constructor(