-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
Description
I followed the documentation (https://github.com/remix-run/remix/tree/main/packages/form-data-parser) and have the following code:
import { parseFormData } from "@remix-run/form-data-parser";
import {v4} from "uuid";
import {join} from "path";
import {tmpdir} from "os";
//
// the code being executed:
//
console.log("PARSING")
const formData = await parseFormData(req, {
maxFileSize: Infinity,
}, async fileUpload=> {
const tempFilePath = join(tmpdir(), v4());
console.log("WRITING");
await writeFile(tempFilePath, fileUpload.bytes as any)
console.log("WROTE");
});
console.log("PARSED")
I checked that my upload has the right content type, both by printing the headers:
'content-type': 'multipart/form-data; boundary=------------------------I2QZnw1ogkdX3FKnotAtEP',
...and by calling isMultipartRequest
from "@remix-run/multipart-parser"
, so that we don't end up in the fallback case, as per the documentation:
Smart fallback - automatically uses native request.formData() for non-multipart/form-data requests
The actual behavior is that "PARSING" gets logged, and the memory spikes in htop
until the machine freezes (if file size exceeds available memory size). It only prints the other logging lines for smaller files, once the file is already in memory.
This issue may derive from the one reported in #10728.
The version for the library is 0.10.1
, and the runtime is Next.js 15.5.4
.