ApeRAG icon indicating copy to clipboard operation
ApeRAG copied to clipboard

[bug] How to increase the file size limit for uploads to the collection

Open klaus-zzz opened this issue 2 months ago • 3 comments

Image

klaus-zzz avatar Sep 30 '25 05:09 klaus-zzz

I want to transfer a file between 10MB and 100MB. I see the default setting in aperag/config.py is 100MB. On the front end, I changed the file limit in web/src/app/workspace/collections/[collectionId]/documents/upload/document-upload.tsx to 100MB. However, when uploading a 50MB PDF file, it fails after getting stuck at 99% and the error log is aperag-frontend | [Error: aborted] { code: 'ECONNRESET' }

klaus-zzz avatar Sep 30 '25 06:09 klaus-zzz

Hey @klaus-zzz,

The issue is that even though you changed the maxSize to 100MB, there are two other limits that are causing your 50MB upload to fail:

1. Upload timeout is too short (this is likely your main problem)

In web/src/app/workspace/collections/[collectionId]/documents/upload/document-upload.tsx line 147, the timeout is only 30 seconds:

timeout: 1000 * 30,  // 30 seconds

For a 50MB file, 30 seconds isn't enough time for both upload and server processing. Change it to at least 5 minutes:

timeout: 1000 * 60 * 5,  // 5 minutes

2. Next.js body size limit

In web/next.config.ts line 36, there's a 10MB limit:

experimental: {
  serverActions: {
    bodySizeLimit: '10mb',  // Change this to '100mb'
  },
},

The ECONNRESET error at 99% happens because the file finishes uploading but the server is still processing it (hashing, validating, saving to storage), and then the 30-second timeout kills the connection.

Try increasing the timeout first - that should fix it. Let me know if you still see issues after that.

earayu avatar Oct 10 '25 06:10 earayu

This issue has been marked as stale because it has been open for 30 days with no activity

github-actions[bot] avatar Nov 10 '25 00:11 github-actions[bot]