-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: MultipartFormData #1620
Comments
Possibly, the same underlying bug as in #669 Can you try importing this to |
I ran into the same issue. The error is triggered by importing (and using)
I tried this and the issue remains |
Not only that, but if you try to make your own handler, the stream just gets stuck. Below is a simple code I did. Sorry, couldn't reproduce on codesandbox, looks like the action is never called on codesandbox. In this code, the log "after for...of" never gets called. edit: I got the code from this video: https://www.youtube.com/watch?v=ySQcGc9NICo import { Form } from "@remix-run/react";
import type { ActionFunction } from "remix";
import { UploadHandler } from "@remix-run/node/formData";
import { parseMultipartFormData } from "@remix-run/node/parseMultipartFormData";
const uploadHandler: UploadHandler = async ({ name, stream, filename }) => {
try {
if (name !== "documents") {
stream.resume();
return;
}
console.log("before for...of", name, filename);
const chunks = [];
for await (const chunk of stream) {
console.log("inside for...of");
chunks.push(chunk);
}
console.log("after for...of");
const buffer = Buffer.concat(chunks);
return "it worked";
} catch (e) {
console.log(e);
return "it did not worked";
}
};
export const action: ActionFunction = async ({ request }) => {
console.log("im at the action");
const body = await parseMultipartFormData(request, uploadHandler);
console.log("body", body);
};
export default function Index() {
return (
<div className="remix__page">
<Form method="post" encType="multipart/form-data">
<input name="documents" type="file" />
<button type="submit">Submit</button>
</Form>
</div>
);
} |
I'm having this issue as well. I would attach screenshots but what's already posted is exactly the same thing I'm seeing. Please let me know what other info I can provide to assist with investigating further. Thanks! |
any update here? is this related? #1628 https://github.com/remix-run/remix/issues/1620 |
Hello everyone! I had the same issue only when importing it from |
Which Remix packages are impacted?
@remix-run/node
What version of Remix are you using?
1.1.3
What version of Node are you using? Minimum supported version is 14.
16.13.1
Steps to Reproduce
remix
or@remix-run/node
.unstable_parseMultipartFormData
unstable_createFileUploadHandler
Browser Console:
🆘 Note: The documentation mentions a function called parseMultipartFormData but to be used you need to use the alias unstable_parseMultipartFormData. The documentation needs to be updated -
Documentation Link: (https://remix.run/docs/en/v1/api/remix#parsemultipartformdata-node)
Expected Behavior
Control the values as the documentation mentions:
let avatarUrl = formData.get("avatar");
...
Actual Behavior
Errors when you use the methods.
Browser Console:
The text was updated successfully, but these errors were encountered: