Skip to content

Cannot handle large files with multipart-parser #10728

@season-goodbye

Description

@season-goodbye

Reproduction

  1. Upload a file via multipart/form-data that exceeds the available memory capacity of the environment.
  2. Convert the request into FormData using parseFormData (@remix-run/form-data-parser).

cf. https://reactrouter.com/how-to/file-uploads

System Info

N/A

Used Package Manager

npm

Expected Behavior

The request should be correctly converted into FormData.

Actual Behavior

The process crashes because it attempts to allocate memory equal to the file size.

This seems to be caused by MultipartParser (@remix-run/multipart-parser) creating a buffer for each part.
cf. https://github.com/mjackson/remix-the-web/blob/88b3716a6eb0b0dcd8ef1e4b5051ccd00593d819/packages/multipart-parser/CHANGELOG.md

Is this a deliberate limitation in react-router to only handle small files?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions