Skip to content

fix(storage): Allow uploads above 6 MiB - #472

Merged
Bohreromir merged 2 commits into
mainfrom
fix/upload-body-size-limit
Nov 17, 2026
Merged

Bohreromir merged 2 commits into
mainfrom
fix/upload-body-size-limit

Conversation

@Bohreromir

@Bohreromir Bohreromir commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Description

The storage browser uploads each file in a single request, so the image's BODY_SIZE_LIMIT of 6M capped uploads at 6 MiB. Raise it to 5G; the upload endpoint streams the body to S3, so this does not grow server memory.

A new hook limits all other routes, most of which buffer the body, to max(6 MiB, editable file size + 1 MiB) by Content-Length, before better-auth or any handler reads it. Bodies without Content-Length are rejected with 411.

A body above BODY_SIZE_LIMIT now answers the upload with 413 instead of 502, and the upload modal says the file is too large. Document the matching ingress-nginx body limit.

Fixes #385

Docs

Release note

Checklist

Author

  • AI review done, findings addressed
  • Tests added or updated
  • Changelog updated (if the repo keeps one)

Reviewer

  • Useful comments and logging
  • Docs added or updated per the style guide

Acceptance

  • Check for release notes and docs

The storage browser uploads each file in a single request, so the image's
BODY_SIZE_LIMIT of 6M capped uploads at 6 MiB. Raise it to 5G; the upload
endpoint streams the body to S3, so this does not grow server memory.

A new hook limits all other routes, most of which buffer the body, to
max(6 MiB, editable file size + 1 MiB) by Content-Length, before better-auth
or any handler reads it. Bodies without Content-Length are rejected with 411.

A body above BODY_SIZE_LIMIT now answers the upload with 413 instead of 502,
and the upload modal says the file is too large. Document the matching
ingress-nginx body limit.
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 67.58% 9291 / 13747
🔵 Statements 66.5% 12469 / 18749
🔵 Functions 68.35% 2987 / 4370
🔵 Branches 57.53% 5241 / 9109
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/hooks.server.ts 0% 0% 0% 0% 34-202
src/lib/components/storage/modals/upload/UploadModal.svelte 74.04% 47.01% 79.23% 70.03% 96-97, 129, 140-142, 157-159, 166-168, 172-173, 200-202, 217-221, 281-334, 348-350, 363-391, 408, 412, 532-535, 614-625
src/lib/server/request-body-limit.ts 100% 100% 100% 100%
src/lib/server/storage/wrap-provider.ts 88.23% 92.3% 100% 86.66% 33, 39
src/routes/(app)/api/storage/upload/+server.ts 100% 100% 100% 100%
Generated in workflow #1319 for commit 57aef38 by the Vitest Coverage Report Action

@Bohreromir
Bohreromir marked this pull request as ready for review November 16, 2026 15:17
@Bohreromir Bohreromir moved this to Development: Waiting for Review in Stackable Engineering Nov 16, 2026
@Bohreromir Bohreromir self-assigned this Nov 16, 2026
@labrenbe
labrenbe self-requested a review November 16, 2026 15:55
Comment thread docker/Dockerfile Resolved
Node's http.Server cuts off any request that takes longer than its
requestTimeout of 300 s to receive, which caps a single-request upload
at about 375 MB on a 10 Mbit/s link. adapter-node does not expose it,
so the container now starts server.js, which wraps build/index.js and
sets requestTimeout from REQUEST_TIMEOUT (default 3600 in the image).
@Bohreromir
Bohreromir requested a review from labrenbe November 17, 2026 11:27

@labrenbe labrenbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Bohreromir
Bohreromir added this pull request to the merge queue Nov 17, 2026
@Bohreromir Bohreromir moved this from Development: Waiting for Review to Development: Done in Stackable Engineering Nov 17, 2026
Merged via the queue into main with commit 3e60037 Nov 17, 2026
12 checks passed
@Bohreromir
Bohreromir deleted the fix/upload-body-size-limit branch November 17, 2026 13:34
@lfrancke lfrancke moved this from Development: Done to Done in Stackable Engineering Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Uploads greater then 6MiB fail

2 participants