You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Part terminated early due to unexpected end of multipart data
on the mail API that uses multer
This seems to be related to the missing knownLength of the attachment from what I have been reading, but the solutions are far and apart. Any idea on this?
EDIT: The above related to the "knownLength" may not be accurate so take it just as a suggestion.
Thanks
The text was updated successfully, but these errors were encountered:
It seems indeed related to the missing known length of the stream + seemingly some other metadata fields that are missing. On the file decryption function, I added the counting of the stream length for each chunk:
...
let file, length = 0;
// decrypt content
r.on("error", function (err) {
if (err) {
callback(err);
}
});
r.on("data", function (chunk) {
// console.log("data");
length += chunk.length;
});
r.on("end", function () {
// console.log("end");
return callback(null, file, fileName, length);
});
file = r.pipe(fileDecipher);
Then, on the file that is sending the request we add the following
Hello,
We have two API's in Node.js. The first one acts as the main hub, while the other one is used to send emails.
Currently I have some files that are encrypted and stored in the file system of the first API. The files get decrypted with the following function:
To send the files we use:
Due to this we receive:
on the mail API that uses multer
This seems to be related to the missing knownLength of the attachment from what I have been reading, but the solutions are far and apart. Any idea on this?
EDIT: The above related to the "knownLength" may not be accurate so take it just as a suggestion.
Thanks
The text was updated successfully, but these errors were encountered: