Closed andysay closed 2 years ago
Would you provide a reproduction please? 🙏
@danielroe I can provide an example as I ran into this same issue
Client
const fd = new FormData();
fd.append("name", fileName);
fd.append("image", file);
axios.post("/api/avatars", fd, {
headers: {
'accept': 'application/json',
'Accept-Language': 'en-US,en;q=0.8',
'Content-Type': `multipart/form-data; boundary=${file._boundary}`,
}
}).then(resp => { console.log(resp)});
Nuxt3 server/api/avatars
import {IncomingMessage, ServerResponse} from "http";
import formidable from "formidable";
const form = new formidable.IncomingForm();
export default async (req: IncomingMessage, res: ServerResponse) => {
form.parse(req, async (err, fields, files) => {
console.log(err);
console.log(fields);
console.log(files);
})
res.end("Got data");
}
The error
ERROR [proxy] write EPIPE
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:98:16)
This code does work when the project is build using nuxt3 build script nuxi build
and running npm start but will not work while using nuxi dev
@danielroe I can provide an example as I ran into this same issue
Client
const fd = new FormData(); fd.append("name", fileName); fd.append("image", file); axios.post("/api/avatars", fd, { headers: { 'accept': 'application/json', 'Accept-Language': 'en-US,en;q=0.8', 'Content-Type': `multipart/form-data; boundary=${file._boundary}`, } }).then(resp => { console.log(resp)});
Nuxt3
server/api/avatars
import {IncomingMessage, ServerResponse} from "http"; import formidable from "formidable"; const form = new formidable.IncomingForm(); export default async (req: IncomingMessage, res: ServerResponse) => { form.parse(req, async (err, fields, files) => { console.log(err); console.log(fields); console.log(files); }) res.end("Got data"); }
The error
ERROR [proxy] write EPIPE at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:98:16)
This code does work when the project is build using nuxt3 build script
nuxi build
and running npm start but will not work while usingnuxi dev
yes approve it ! works only on build state.
Can confirm I run into the exact same issue.
I ran into exactly this issue today, how did you resolve this?
I ran into exactly this issue today, how did you resolve this?
Provide a reproduction and there might be an answer to this question 😄
@manniL Thanks for getting back on this, I've just found a solution at another issue https://github.com/unjs/h3/issues/43#issuecomment-1069225214. Would have provided one otherwise :)
Great to hear ☺️
Environment
Darwin
v16.11.1
3.0.0-27257216.f5aea9f
npm
Vite
vite
,build
-
Build Modules:
-
Describe the bug
bug only on dev mode. build woking fine.
i have next method.
axios.post("/api/upload", formData, { headers: { "Content-Type": "multipart/form-data", }, });
formData have binary data.
on server
ERROR [proxy] write EPIPE 10:14:03
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:98:16)
if server build and started will work fine.
Reproduction
not have
Additional context
No response
Logs
No response