Skip to content

bug(frontend): 413 Payload Too Large on BIDS uploads and missing Next.js config in Dockerfile #6

@chinmayy777

Description

@chinmayy777

Bug Description
When uploading a real-world ASL dataset (like the asl003 sample), the frontend crashes. Next.js 15 enforces a default 1MB bodySizeLimit on Server Actions, which rejects large BIDS/DICOM payloads before they can reach the FastAPI backend. Additionally, the multi-stage Dockerfile fails to copy next.config.ts into the final production image, making any configuration changes ignored in production.

Steps to Reproduce

  1. Go to the local frontend running via Docker (http://localhost:3000)
  2. Click on 'Choose Folder' and select a BIDS dataset larger than 1MB.
  3. Click 'Upload ASL BIDS'.
  4. See error: The UI throws an unexpected error, and the Terminal shows a 413 Body exceeded 1 MB limit rejection.

Expected Behavior
The Next.js frontend should accept large medical imaging payloads (e.g., up to 100MB) and successfully pass them to the FastAPI backend without intercepting and killing the request.

Actual Behavior
The request is immediately killed by Next.js with a 413 status code, and the FastAPI backend never receives the files.

Environment

  • OS: Linux Ubuntu 24.04.4 LTS (Running via Docker)
  • Browser: Chrome (Version 145.0.7632.109)
  • Node.js Version: 20-alpine (Docker container)

Additional Context

  • The fix requires setting bodySizeLimit: '100mb' inside serverActions in next.config.ts.
  • The Dockerfile runner stage must be updated with COPY --from=builder /app/next.config.ts ./ so the compiled app respects the limit.
  • The screenshots of the issue as well as the error logs can be found below.

I will open a PR that will resolve this issue as well as issue #5

Image Image

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