Unable to download the file to the server with Node.js and React Native

We are faced with a very strange behavior in our application.

We have a Node.js server running on Heroku. Our client is a native React application that attempts to send a file to our server.

Front Code:

import ImagePicker from "react-native-image-picker";

The MyComponent class expands React.Component {

...

handleGallery = () => {
ImagePicker.showImagePicker (pickerOptions, response => {

const {uri, type, filename} = answer;
const data = new FormData ();

data.append ("data", {uri, type, name: `photo. $ {FileName}`});

this.submitMultpart (data)
.then (res => {
console.log (res);
})
.catch (err => {
console.log (err);
});
}
});
};

submitMultpart = formData => {
return a new promise ((solve, reject) => {
const URL = "https://example.com/api/upload";

const options = {
method: "POST",
body: formData,
headers: {
Accept: "application / json",
"Content-Type": "multipart / form-data; border = 6ff46e0b6b5148d984f148b6542e5a5d",
}
};

search (URL, options)
.then (res => {
console.log (res);
solve (res);
})
.catch (err => {
console.log (JSON.stringify (err));
reject (err);
});
});
};
}

Back-end code:

const multiparty = require ("multiparty");

app.post ("/ api / upload", async (req, res) => {
const form = new multiparty.Form ();

form.parse (req, async (error, _fields, files) => {
if (error) {
console.error (error);
return res.status (500) .json ({success: false});
}

// do some stuff here


return res.status (200) .json ({hit: true});
});
});

The error I receive in the console node.js is as follows:

{
BadRequestError: The flow has ended unexpectedly
has the form.(/ app / node_modules / multiparty / index.js: 759: 24)
at Form.emit (events.js: 194: 15)
at finishMaybe (_stream_writable.js: 641: 14)
at endWritable (_stream_writable.js: 649: 3)
at Form.Writable.end (_stream_writable.js: 589: 5)
at IncomingMessage.onend (_stream_readable.js: 629: 10)
on Object.onceWrapper (events.js: 277: 13)
at IncomingMessage.emit (events.js: 194: 15)
at endReadableNT (_stream_readable.js: 1103: 12)
at process._tickCallback (internal / process / next_tick.js: 63: 19) message: "the flow ended unexpectedly"
}

p.s: The headers are correctly defined by the FETCH api. We receive them on the back-end.

p.s2: By using postman, I can send files to my server (using the same headers as the ones I've used in FETCH api. The request is successfully analyzed in the backend and I receive the file)

p.s3: The file I am trying to send is very small, so it seems that the file size is not a problem here.

p.s4: I use a random limit in the headers of the query because, without that, I get this error:

{
BadRequestError: Missing limit in content type
at Form.parse (/app/node_modules/multiparty/index.js:180:21)
at app.post (/app/routes/api/personalDocumentRoute.js:12:10)
at Layer.handle [as handle_request] (/App/node_modules/express/lib/router/layer.js:95:5)
at next (/app/node_modules/express/lib/router/route.js:137:13)
at admin.auth.verifyIdToken.then.firebaseUser (/app/middlewares/requireFirebaseLogin.js:26:14)
at process._tickCallback (internal / process / next_tick.js: 68: 7) message: "missing content limit"
}

Additional information:

package.json:

"react": "16.6.3",
"react-native": "0.58.3",

Any help would be incredible. Many hours of debugging without success: /