Skip to content

Commit 31da681

Browse files
feat(api): increase file upload size limits to 100MB (#1959)
Co-authored-by: Tofik Hasanov <[email protected]>
1 parent 4613555 commit 31da681

File tree

15 files changed

+25
-21
lines changed

15 files changed

+25
-21
lines changed

apps/api/src/attachments/attachments.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { UploadAttachmentDto } from './upload-attachment.dto';
1919
export class AttachmentsService {
2020
private s3Client: S3Client;
2121
private bucketName: string;
22-
private readonly MAX_FILE_SIZE_BYTES = 60 * 1024 * 1024; // 60MB
22+
private readonly MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024; // 100MB
2323
private readonly SIGNED_URL_EXPIRY = 900; // 15 minutes
2424

2525
constructor() {

apps/api/src/knowledge-base/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
// File size limits
6-
export const MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024; // 10MB
6+
export const MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024; // 100MB
77

88
// Signed URL expiration
99
export const SIGNED_URL_EXPIRATION_SECONDS = 3600; // 1 hour

apps/api/src/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ async function bootstrap(): Promise<void> {
3838
);
3939

4040
// STEP 3: Configure body parser
41-
app.use(express.json({ limit: '70mb' }));
42-
app.use(express.urlencoded({ limit: '70mb', extended: true }));
41+
// NOTE: Attachment uploads are sent as base64 in JSON, so request payloads are
42+
// larger than the raw file size. Keep this above the user-facing max file size.
43+
app.use(express.json({ limit: '150mb' }));
44+
app.use(express.urlencoded({ limit: '150mb', extended: true }));
4345

4446
// STEP 4: Enable global pipes and filters
4547
app.useGlobalPipes(

apps/api/src/questionnaire/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const MIN_CHUNK_SIZE_CHARS = 5_000;
88
export const MAX_QUESTIONS_PER_CHUNK = 1;
99

1010
// File size limits
11-
export const MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024; // 10MB
11+
export const MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024; // 100MB
1212

1313
// LLM Model identifiers
1414
export const PARSING_MODEL = 'gpt-5-mini';

apps/api/src/tasks/attachments.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { UploadAttachmentDto } from './dto/upload-attachment.dto';
2020
export class AttachmentsService {
2121
private s3Client: S3Client;
2222
private bucketName: string;
23-
private readonly MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024; // 10MB
23+
private readonly MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024; // 100MB
2424
private readonly SIGNED_URL_EXPIRY = 900; // 15 minutes
2525

2626
constructor() {

apps/api/src/trust-portal/trust-portal.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface VercelDomainResponse {
4444
export class TrustPortalService {
4545
private readonly logger = new Logger(TrustPortalService.name);
4646
private readonly vercelApi: AxiosInstance;
47-
private readonly MAX_FILE_SIZE_BYTES = 50 * 1024 * 1024;
47+
private readonly MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024;
4848
private readonly SIGNED_URL_EXPIRY_SECONDS = 900;
4949

5050
constructor() {

apps/app/next.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const config: NextConfig = {
5252

5353
experimental: {
5454
serverActions: {
55-
bodySizeLimit: '15mb',
55+
// NOTE: Attachment uploads may be sent as base64 strings, which increases payload size.
56+
// Keep this above the user-facing max file size.
57+
bodySizeLimit: '150mb',
5658
allowedOrigins:
5759
process.env.NODE_ENV === 'production'
5860
? ([process.env.NEXT_PUBLIC_PORTAL_URL, 'https://app.trycomp.ai'].filter(

apps/app/src/actions/files/upload-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const uploadFile = async (input: z.infer<typeof uploadAttachmentSchema>)
9393
console.log('[uploadFile] Converting file data to buffer');
9494
const fileBuffer = Buffer.from(fileData, 'base64');
9595

96-
const MAX_FILE_SIZE_MB = 10;
96+
const MAX_FILE_SIZE_MB = 100;
9797
const MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024;
9898
if (fileBuffer.length > MAX_FILE_SIZE_BYTES) {
9999
logger.warn(

apps/app/src/app/(app)/[orgId]/questionnaire/components/QuestionnaireSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function QuestionnaireSidebar() {
3838
<ul className="text-xs text-muted-foreground space-y-1.5">
3939
<li className="flex items-start gap-2">
4040
<span className="text-primary mt-0.5"></span>
41-
<span>Files up to 10MB are supported</span>
41+
<span>Files up to 100MB are supported</span>
4242
</li>
4343
<li className="flex items-start gap-2">
4444
<span className="text-primary mt-0.5"></span>

apps/app/src/app/(app)/[orgId]/questionnaire/components/QuestionnaireUpload.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function QuestionnaireUpload({
5959
) : (
6060
<Dropzone
6161
onDrop={onFileSelect}
62-
maxSize={10 * 1024 * 1024}
62+
maxSize={100 * 1024 * 1024}
6363
maxFiles={1}
6464
multiple={false}
6565
disabled={isLoading}
@@ -89,7 +89,7 @@ export function QuestionnaireUpload({
8989
{isDragActive ? 'Drop file here' : 'Drag & drop or click to select'}
9090
</p>
9191
<p className="text-xs text-muted-foreground">
92-
PDF, Excel, CSV (max 10MB)
92+
PDF, Excel, CSV (max 100MB)
9393
</p>
9494
</div>
9595
</div>

0 commit comments

Comments
 (0)