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
I am having this annoying issue while using http proxies. The exception happens in the global context and doesn't leave much of a stack trace.
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TCP.onread (net.js:615:25)
which can only be caught using the "process.on('uncaughtException', ...)" event.
If I remove the proxies then no uncaught exceptions are thrown. I have looked at the related issues but I have yet to find anything that allows me to catch the exception on the request:
process.on('uncaughtException',function(err){debugger;console.log(err);//exception can only be caught here});for(leti=0;i<2000;++i){letuserAStr=random_useragent.getRandom();letreq=npl.request({gzip: true,method: 'GET',uri: 'https://nyaa.si/view/1116270',timeout: 30*1000,maxRedirects: '10',followRedirect: true,rejectUnauthorized: false,insecure: true,headers: {'user-agent': userAStr}}).catch(e=>{if(e.statusCode!==404)debugger;});allTests.push(req);}Promise.all(allTests).then(all=>{debugger;})
and here is the request code, as you can see I have tried a lot of things to try and catch this exception.
privatereqProm(ops){returnnewPromise((c,e)=>{letprom;lethandle=setTimeout(()=>{prom&&prom['cancel']&&prom['cancel']();e({error: {code: 'ESOCKETTIMEDOUT'}})},this['timeout']);try{ops.gzip=true;if(!ops.headers)ops.headers={};ops.headers.Connection='keep-alive';console.log("trying",ops);letrr=rp(ops).on('error',err=>{console.log('got in error event',err.message);clearTimeout(handle);e({error:err});}).on('socket',sock=>{sock.on('error',err=>{console.log('got in sock error event',err.message);clearTimeout(handle);e({error:err});})})rr.then((res)=>{clearTimeout(handle);c(res);}).catch(err=>{clearTimeout(handle);e(err);});rr.end();}catch(err){clearTimeout(handle);e(err);}})}
The issue doesn't happen all the time, in fact, it takes many request before it occurs. The code is part of a github library that I am trying to create.
"https://github.com/jerradpatch/node-proxy-pools"
It currently needs a key for a proxy api called "Proxy Rotator". If the problem isnt obvious, you need to run the code, and you would like to borrow my key in order to help me figure it out. I would be willing to give the key to any active contributor of the request-promise library. Thanks so much for your help.
The text was updated successfully, but these errors were encountered:
I am having this annoying issue while using http proxies. The exception happens in the global context and doesn't leave much of a stack trace.
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TCP.onread (net.js:615:25)
which can only be caught using the "process.on('uncaughtException', ...)" event.
If I remove the proxies then no uncaught exceptions are thrown. I have looked at the related issues but I have yet to find anything that allows me to catch the exception on the request:
"request/request#3131"
"request/request#2986"
"request/request#2846"
I am calling the request like this:
and here is the request code, as you can see I have tried a lot of things to try and catch this exception.
The issue doesn't happen all the time, in fact, it takes many request before it occurs. The code is part of a github library that I am trying to create.
"https://github.com/jerradpatch/node-proxy-pools"
It currently needs a key for a proxy api called "Proxy Rotator". If the problem isnt obvious, you need to run the code, and you would like to borrow my key in order to help me figure it out. I would be willing to give the key to any active contributor of the request-promise library. Thanks so much for your help.
The text was updated successfully, but these errors were encountered: