asynchronous - Meteor npm get request ECONNRESET -


i using following method uploading s3 bucket in meteor. request, , if there response, upload s3 bucket. have around 700 urls that. http request each url, , try upload s3. main problem @ beginning, 150 files getting following error:

i20170725-22:22:39.344(2)? error occured during upload:  { [error:  connect econnreset https://pushmetrics.com:443] i20170725-22:22:39.344(2)?   code: 'econnreset', i20170725-22:22:39.344(2)?   errno: 'econnreset', i20170725-22:22:39.345(2)?   syscall: 'connect', i20170725-22:22:39.345(2)?   address: 'https://pushmetrics.com', i20170725-22:22:39.345(2)?   port: 443 

after works other files. first 150 urls failing.

uploadtos3: (url, headers, connectionid, itemid, itemname, type) => {     return new promise(function(resolve, reject) {         request.get({             url: url,             headers: headers,             rejectunauthorized: false,         }, function(error, response, body) {             if (error) {                   reject(error);             } else {                 // create s3 service object                 var s3 = new aws.s3();                 // bucketname var below crates "folder" each item                 var bucketname = '/connections/' + connectionid + '/' + type + '/' + itemid + '/';                 var params = {                     bucket: meteor.settings.private.s3.bucket,                     key: bucketname + itemname + '.png',                     body: body,                     contenttype: 'image/png',                     acl: 'public-read'                 };                 s3.upload(params, function (err, data) {                     if (err) {                         console.log(`error during upload file ${params.key} s3: ${err}"`);                         return res.status(500).send(err)                     };                     let s3url = data.location;                     resolve(s3url)                 });             }         });     }); }, 

method uploadtos3 invoked following async method:

uploaditemtos3: async (url, headers, connectionid, itemid, itemname, type) => {     s3url = await api.uploadtos3(url, headers, connectionid, itemid, itemname, type);     return s3url; } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -