codemanki / cloudscraper

--DEPRECATED -- 🛑 🛑 Node.js library to bypass cloudflare's anti-ddos page
MIT License
599 stars 139 forks source link

ECONNRESET #334

Open skessler1964 opened 4 years ago

skessler1964 commented 4 years ago

Cloudscraper Version : Latest fetch as of 03/02/2020 Node Version : 12.14.1 Onset of Issue : 03/02/2020 Frequency : Chronic Url: https://www.okcupid.com/login

// CODE SNIPPET OKCupid.prototype.logincs = function(username, password, callback){ var options = { uri: URLS.login, formData: { okc_api: 1, username: username, password: password, } }; cloudscraper.post(options, callback); }

// TRACE REQUEST emitting complete https://www.okcupid.com/login REQUEST { requester: [Function: request] { get: [Function], head: [Function], options: [Function], post: [Function], put: [Function], patch: [Function], del: [Function], delete: [Function], jar: [Function], cookie: [Function], defaults: [Function], forever: [Function], Request: [Function: Request] { debug: undefined, defaultProxyHeaderWhiteList: [Array], defaultProxyHeaderExclusiveList: [Array] }, initParams: [Function: initParams], debug: [Getter/Setter], bindCLS: [Function: RP$bindCLS] }, jar: RequestJar { _jar: CookieJar { enableLooseMode: true, store: [MemoryCookieStore] } }, headers: { Host: Symbol(host), Connection: 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.28 Safari/537.36', Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', Referer: 'https://www.okcupid.com/login' }, cloudflareMaxTimeout: 30000, followAllRedirects: true, challengesToSolve: 2, decodeEmails: false, gzip: true, agentOptions: { ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA:!ECDHE+SHA:!AES128-SHA' }, uri: 'https://www.okcupid.com/login?__cf_chl_jschl_tk__=89fc91eaf3dc22dc4c0cf569595ffa02031c0183-1583153456-0-ARLi8X50vCyq4DUmwy2lb1zTNaw3YAgyXLtFJH9yIiEFtxO_n-xNqzeCrSTGCnXsaItR6360Pt2Wx46WkcFZInO64ksDvx7DWDzH4DmZcs3uHTHWEzp_UER7Xza_n_C0lkFiKd51HrvAeyY3rvUav-L19GJ6GLMuiFCYb-hGHPX5jCJYDFwxBUSd7CfCv5mm36QSlFtwYadPfN_blcz4o7RgWMErvwsM2N5x1fVm8gS5oJwGtYdnns4Izs3jvvRr4AAcf5IXBKTvfk5KDpEtdmMEhlFfk3swaSCc1JDzJSmNz5CcKbfpvK-dalpuqaGWzjHVjPW_Sxjt8_2Dllhk39E', formData: { okc_api: 1, username: 'xxxxxxxxx', password: 'xxxxxxxxx' }, callback: [Function: RP$callback], method: 'POST', realEncoding: 'utf8', encoding: null, form: { r: '3ec5dd8f6995fcc345d963eea33f659a3a29cf0f-1583153456-0-ARb2FpFnJx8m+DbRZE4ugg2pyAZjd0JNGtJ6nFgk0pETTqm1DgnMQV3rkhkE+3D7E1sE8ZKdluG/gQFCO9lrU699Zg30ZndiyPTJFMA5TbVv9KKGPzDPSa3kcyFHwsGD/DmuVftlQPS66pDaoh1LKrbfmHU29vYSsrHvLzRdpT7Gsd/S5Hae0iSRrjeceMBmYuUQkc2d/dBfes+edBl/8lKTxeUcCnXuWJmAEOqfgTwyJfex5SkUp4y6U1tIEgtNtej3UQp4GFViUdE/hxjqVM9UEbkAzod+vkITB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TeEOIIsB8euVJywAQAGy2+qFClc/+XQOoqAa5tBjkFyEMkF2ehd5YIYf5ys9KvzswjqC5OxdLXIYwzxCvtQfhiah7M1wTtFl3Qhj5y8B+RsYtsHoFqJ20CpvlCLDUMTB1mpZWgFFiFRhQOvvT/aKpIrVmrsxc0fNnOjHnESeMEqor/74qXfQWQ2kd8Vpu8pjyRJ4YuDgrnsaegPk1RL4d1UWD0g7BSz+5XkFSjyamv7utwrFz/ZgGAX7WH+Nop/3+SYMY8Dxdn2D9U4ZA1bUrCPkduHduvS9HXB4U+COAWallYWix/GVxEEXoELraEOcjZKsqlGTHZlkXv5bPOLnlp/9PUrd8713Su0FiGsG2khOBTzWYIKCGP+NW9OE2EcDOhsrhO6m/Fz2GVTU1GRE79Kal/pKcECHdyw/Qq1c8fLZUk5OinrIhn4vBS50KVyEdhia1nkkbgFGB9wYiOJpzAMgRiLZtW3NNQ==', jschl_vc: 'b8e5361aaac4476fd740736bfd2cf221', pass: '1583153460.447-Vyi2H6eBOq', jschl_answer: '15.4463356533' }, transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false } REQUEST make request https://www.okcupid.com/login?__cf_chl_jschl_tk__=89fc91eaf3dc22dc4c0cf569595ffa02031c0183-1583153456-0-ARLi8X50vCyq4DUmwy2lb1zTNaw3YAgyXLtFJH9yIiEFtxO_n-xNqzeCrSTGCnXsaItR6360Pt2Wx46WkcFZInO64ksDvx7DWDzH4DmZcs3uHTHWEzp_UER7Xza_n_C0lkFiKd51HrvAeyY3rvUav-L19GJ6GLMuiFCYb-hGHPX5jCJYDFwxBUSd7CfCv5mm36QSlFtwYadPfN_blcz4o7RgWMErvwsM2N5x1fVm8gS5oJwGtYdnns4Izs3jvvRr4AAcf5IXBKTvfk5KDpEtdmMEhlFfk3swaSCc1JDzJSmNz5CcKbfpvK-dalpuqaGWzjHVjPW_Sxjt8_2Dllhk39E Unhandled rejection RequestError: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at onRequestResponse (C:\download\okc\okcupidjs-master\node_modules\cloudscraper\index.js:165:21) at Request. (C:\download\okc\okcupidjs-master\node_modules\cloudscraper\index.js:144:7) at Object.onceWrapper (events.js:313:26) at Request.emit (events.js:223:5) at Request.onRequestError (C:\download\okc\okcupidjs-master\node_modules\request\request.js:880:8) at ClientRequest.emit (events.js:223:5) at writeAfterEndNT (_http_outgoing.js:649:7) at processTicksAndRejections (internal/process/task_queues.js:82:21)

events.js:200 throw er; // Unhandled 'error' event ^

Error: read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:200:27) Emitted 'error' event on Request instance at: at Request.onRequestError (C:\download\okc\okcupidjs-master\node_modules\request\request.js:880:8) at ClientRequest.emit (events.js:223:5) at TLSSocket.socketErrorListener (_http_client.js:406:9) at TLSSocket.emit (events.js:223:5) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:81:21) { errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

tkothe commented 4 years ago

I'm having pretty much the same error. I am running my script in Google Cloud Run from where it hits Cloudflare on this Czech website. (I only need Cloudscraper for that purpose - locally in Czech it's running without any Cloudflare protection, apparently).

Below is the relevant part from the logs extracted (it was a little more tricky to do as Google Cloud Run adds all kinds of fun stuff to the logs).

Any pointers as to what this could be related to would be greatly appreciated.

timestamp  message
2020-03-22T12:46:08.558456Z here we go...
2020-03-22T12:46:26.326812Z that's an error RequestError
2020-03-22T12:46:27.026954Z RequestError: Error [ERR_STREAM_WRITE_AFTER_END]: write after endat onRequestResponse (/node_modules/cloudscraper/index.js:165:21)at Request. (/node_modules/cloudscraper/index.js:144:7)at Object.onceWrapper (events.js:423:26)at Request.emit (events.js:316:20)at Request.onRequestError (/node_modules/request/request.js:877:8)at ClientRequest.emit (events.js:328:22)at writeAfterEndNT (_http_outgoing.js:701:7)at processTicksAndRejections (internal/process/task_queues.js:85:21) {
2020-03-22T12:46:27.026983Z name: 'RequestError',
2020-03-22T12:46:27.026993Z message: 'Error [ERR_STREAM_WRITE_AFTER_END]: write after end'
2020-03-22T12:46:43.026450Z events.js:293
2020-03-22T12:46:43.026501Z throw er; // Unhandled 'error' event
2020-03-22T12:46:43.026514Z ^
2020-03-22T12:46:43.026526Z  
2020-03-22T12:46:43.026557Z Error: read ECONNRESETat TLSWrap.onStreamRead (internal/stream_base_commons.js:205:27)
2020-03-22T12:46:43.026569Z Emitted 'error' event on Request instance at:
2020-03-22T12:46:43.026581Z at Request.onRequestError (/node_modules/request/request.js:877:8)
2020-03-22T12:46:43.026590Z at ClientRequest.emit (events.js:328:22)
2020-03-22T12:46:43.026601Z at TLSSocket.socketErrorListener (_http_client.js:432:9)
2020-03-22T12:46:43.026610Z at TLSSocket.emit (events.js:316:20)
2020-03-22T12:46:43.026623Z at emitErrorNT (internal/streams/destroy.js:84:8)
2020-03-22T12:46:43.026634Z at processTicksAndRejections (internal/process/task_queues.js:84:21) {
2020-03-22T12:46:43.026643Z errno: -104,
2020-03-22T12:46:43.026652Z code: 'ECONNRESET',
2020-03-22T12:46:43.026661Z syscall: 'read'
2020-03-22T12:46:50.227333300Z Container called exit(1).