Does cross-domain failure occur when asynchronous requests are made after receiving front-end uploaded data using formidable?

  node.js, question

The front-end encapsulates the FormData object post to the back-end nodejs. nodejs uses formidable to parse the request. Up to this point, there has been no problem. nodejs can successfully parse the request and print out the desired data. However, I wanted to send the data obtained after parsing the request to the python server through superagent post, so I used promise to separate the two transactions, but failed. Browser prompts cross domain …

Error: Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.
 ...Possible causes: the network is offline, Origin is not allowed by Access-Control  ...

The same error occurred when I changed the post request part to an asynchronous task like simple setTimeout. In a word, the data I got after parsing the request with formidable cannot be used for the next asynchronous task, and cross-domain will be prompted as soon as it is executed.
There will be no problem if the Formable parsing request is used alone without the subsequent asynchronous request, and there will be no problem if the fake data is used alone to execute the subsequent asynchronous request without the Formable parsing request to obtain the data. But when they are combined, they are wrong. …
This bug has been bothering me for three days, but it can’t be solved, so I’m here to ask all the great gods for help. I’m very grateful.
This is the code for my nodejs interface:"/api/publish_activity", function( req, res, next ){
 //Subsequent asynchronous tasks
 function async_task( result ){
 return new Promise( ( resolve, reject ) => {
 console.log(  result )
 fetch_data_post( back_end_router.publish_activity, result )
 } )
 //formidable Resolve Request
 formidablePromise( req )
 .then( ( result ) => {
 return async_task( result )
 } )
 .then( ( async_task_result ) => {
 res.json( { error : async_task_result.body.error, message : async_task_result.body.message } )
 } )
 .catch(( error ) => console.log( error ))

This is formidablePromise, which is used to parse the request and return the parsed data:

function formidablePromise( req ){
 return new Promise(( resolve, reject ) => {
 //under which folder will the picture file be uploaded
 var uploadfoldername = "uploadfiles";
 var uploadfolderpath = path.resolve( __dirname, "../asset/", uploadfoldername );
 //parameter setting
 var form = new formidable.IncomingForm({
 encoding : "utf-8",
 uploadDir : uploadfolderpath,
 keepExtensions : true
 //Save Field
 var fieldList = {
 //save picture url
 var fileList = [  ];
 //parse request
 form.parse( req )
 .on( "error", function( err ) { return reject( err ) } )
 .on( "field", function( name, value ) {
 fieldList[ name ] = value
 } )
 .on( "file", function( name, file ) {
 var filename = ( new Date(  ) ).getTime(  );
 switch ( file.type ){
 case "image/jpeg" :
 Filename = filename plus ".jpg"
 case "image/png" :
 Filename = filename plus ".png"
 default :
 Filename = filename plus ".png"
 Varfile _ save _ path = uploadfolderpath plus "/"plus filename;
 console.log( file.path );
 fs.rename( file.path, file_save_path, function(err) {
 if ( err ) {
 console.log( err )
 } );
 Var filepath = "http:// "plus server plus": "plus port plus"/"plus uploadfoldername plus"/"plus filename;
 fileList.push( filepath );
 } )
 .on( "end", function(  ){
 var result = { fieldList : fieldList, fileList : fileList };
 resolve( result );
 } )

Fetch_data_post is a method of encapsulating superagent post requests with promise:

fetch_data_post : function( url, post_data, content_type ){
 var content_type = typeof( content_type ) !  = "undefined" ?  content_type : { "Content-Type" : "application/x-www-form-urlencoded" }
 return new Promise(( resolve, reject ) => {
 .post( url )
 .set( content_type )
 .send( post_data )
 .end(( error, result ) => {
 error ?   reject( error ) : resolve( result );

If you upload two files, how do you write them if the paths are different? Formidable