Skip to content

Uploads fail under bulk load with 524 timeouts and misleading CORS errors #8

Description

@ryanmcdonough

Summary

Uploading multiple large files consistently fails in production. What shows up in the browser looks like a CORS issue, but it’s actually timeouts under load.

That makes it harder to debug and breaks a normal workflow, uploading a batch of documents.


Environment

Frontend: https://app.mikeoss.com
API: https://api.mikeoss.com

Endpoints:

  • POST /single-documents
  • POST /projects/:projectId/documents

Reproduction

  1. Log into the app
  2. Upload ~20 files at ~40MB each
  3. Observe network tab and console

Actual Behaviour

  • Requests fail with status 524
  • Browser reports:
    • "Origin not allowed by Access-Control-Allow-Origin"
    • "Fetch API cannot load…"
    • "TypeError: Load failed"
  • Failures occur across both upload paths
  • Frontend retries appear to amplify load

Expected Behaviour

  • Uploads either succeed within supported limits
  • Or fail cleanly with explicit responses (e.g. 413, 429, 503)
  • All responses include valid CORS headers
  • UI shows clear per-file outcomes

What’s Actually Happening

This is not a CORS issue. It’s timeout behaviour surfacing as CORS because the response does not complete properly.

Under load:

  • Requests exceed execution window → Cloudflare returns 524
  • Error responses bypass normal middleware
  • CORS headers are missing → browser reports access control failure

Likely Causes

Synchronous processing in request path
Upload → parse → extract → respond in a single request does not scale under concurrency

Unbounded parallel uploads
Client sends multiple large files simultaneously without effective throttling

Memory pressure from request handling
Every JSON endpoint shares:

express.json({ limit: "50mb" })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions