fix(office_server): bump axum body limit to allow real uploads #20

Closed
opened 2026-04-27 12:54:26 +00:00 by zaelgohary · 0 comments
Member

Symptom

Browser uploads via the docs/sheets/presentations/pdf island fail with network error: TypeError: Failed to fetch for any non-trivial file. Direct probe via curl against the UDS confirms the failure originates server-side:

$ curl --unix-socket ~/hero/var/sockets/hero_office/rpc.sock -X POST \
       -H 'Content-Type: application/json' --data-binary @5mb_payload.json \
       http://localhost/rpc
413 Failed to buffer the request body: length limit exceeded

Root cause: hero_office_server's axum router (crates/hero_office_server/src/main.rs:86) builds the Router with no DefaultBodyLimit layer, so the framework default of 2 MB applies. After base64 inflation (4/3×) the threshold is reached around a ~1.5 MB raw file.

Acceptance

  • Uploads up to a sensible cap (proposed: 100 MB raw → ~134 MB JSON) succeed via upload_document.
  • 5 MB curl probe returns 200 {"success": true, ...}, no 413.
  • Browser upload of a real-world PDF (≥10 MB) completes through the office views UI.
  • Existing tests / playwright office_editor_real stay green.
## Symptom Browser uploads via the docs/sheets/presentations/pdf island fail with `network error: TypeError: Failed to fetch` for any non-trivial file. Direct probe via `curl` against the UDS confirms the failure originates server-side: ``` $ curl --unix-socket ~/hero/var/sockets/hero_office/rpc.sock -X POST \ -H 'Content-Type: application/json' --data-binary @5mb_payload.json \ http://localhost/rpc 413 Failed to buffer the request body: length limit exceeded ``` Root cause: `hero_office_server`'s axum router (`crates/hero_office_server/src/main.rs:86`) builds the `Router` with no `DefaultBodyLimit` layer, so the framework default of **2 MB** applies. After base64 inflation (4/3×) the threshold is reached around a **~1.5 MB raw file**. ## Acceptance - Uploads up to a sensible cap (proposed: 100 MB raw → ~134 MB JSON) succeed via `upload_document`. - 5 MB curl probe returns `200 {"success": true, ...}`, no 413. - Browser upload of a real-world PDF (≥10 MB) completes through the office views UI. - Existing tests / playwright `office_editor_real` stay green.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_office#20
No description provided.