Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

feat: make upload chunk size configurable#273

Merged
danielalves96 merged 3 commits into
kyantech:nextfrom
bawahakim:feat/configurable-chunk-size
Oct 2, 2025
Merged

feat: make upload chunk size configurable#273
danielalves96 merged 3 commits into
kyantech:nextfrom
bawahakim:feat/configurable-chunk-size

Conversation

@bawahakim
Copy link
Copy Markdown
Contributor

📝 Description

Adds a configurable upload chunk size

  • Chunk logic
    apps/web/src/utils/chunked-upload.ts now respects NEXT_PUBLIC_UPLOAD_CHUNK_SIZE_MB and falls back to optimal sizing when unset/invalid.
  • Env template documents the new variable in apps/web/.env.example
  • Docs add “Upload Configuration” guidance in apps/docs/content/docs/3.2-beta/manual-installation.mdx

🔗 Related Issue(s)

None

💡 Motivation and Context

Although the optimal chunk size calculation is great, it causes issues with some proxies with limited upload limit, like Cloudflare (100mb on free plan). Using chunk uploads of less than 100mb in this case would fix the issue.

🤖 Use of Artificial Intelligence (AI)

The use of AI tools is absolutely welcome and not an issue. For transparency and continuous improvement, please answer the following:

  • Did you use any AI tools (such as GitHub Copilot, ChatGPT, etc.) to help develop this PR?
    • No, this PR was developed without the assistance of AI tools.
    • Yes, AI tools assisted in the development of this PR (please specify which ones and how they were used):
      • Tool(s) used: Windsurf, GPT-5-Codex, Claude Sonnet 4.5
      • Brief description of how AI contributed: Understand the code structure, write minimal changes (tweaked and approved by human engineer), write documentation
  • Was this PR generated entirely by an AI tool (i.e., with minimal human intervention)?
    • No
    • Yes (please provide details): Only the summary was generated

🧪 How Has This Been Tested?

Manual User Action Tests

  • [Env: set below-threshold file]

    1. In apps/web/.env, set NEXT_PUBLIC_UPLOAD_CHUNK_SIZE_MB=50.
    2. Upload a file smaller than 50 MB. Expect a single file to be uploaded (not chunked)
  • [Env: set above-threshold file]

    1. With the same env value, upload a file larger than 50 MB.
    2. Confirm multiple chunk requests appear, using the configured ~50 MB chunk size
  • [Env: unset fallback]

    1. Remove or comment NEXT_PUBLIC_UPLOAD_CHUNK_SIZE_MB and restart pnpm dev.
    2. Upload a file ≤100 MB; expect a single upload (no chunking).
    3. Upload a file between 100 MB and 1 GB; expect 75 MB chunks.
    4. Upload a file >1 GB; expect 150 MB chunks. These defaults validate the automatic sizing logic.
  • [Optional invalid value check]

    1. Set an invalid value (e.g., NEXT_PUBLIC_UPLOAD_CHUNK_SIZE_MB=abc), restart, reload.
    2. Observe the console warning issued and repeat the >100 MB upload to verify fallback to optimal sizing.

📸 Screenshots (if appropriate)

N/A

🔄 Types of Changes

Check the relevant option(s) below:

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 📚 Documentation update

✅ Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have rebased and/or merged on top of the latest next branch

🙏 Thank you for your contribution!

@danielalves96 danielalves96 merged commit 59f9e19 into kyantech:next Oct 2, 2025
anthony0030 pushed a commit to anthony0030/Palmr that referenced this pull request Jan 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants