Sansossio / twisted

Fetching riot games api data
125 stars 47 forks source link

Getting an error I've never seen before #115

Closed RedFr4me closed 6 months ago

RedFr4me commented 6 months ago

Hey, I'm having a new error when scrapping games, it currently stops my script from running with no retry mechanism setup, this errror happens randomly when I'm scrapping games, here it happened after 50k games. Sometimes after 2k games, etc....

An error occurred while processing matches: GenericError: socket hang up
    at MatchV5Api.getError (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:148:16)
    at MatchV5Api.<anonymous> (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:155:36)
    at Generator.next (<anonymous>)
    at C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:31:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:27:12)
    at MatchV5Api.retryRateLimit (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:154:16)
    at MatchV5Api.<anonymous> (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:236:35)
    at Generator.throw (<anonymous>)
    at rejected (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\twisted\dist\base\base.js:29:65) {
  status: 500,
  body: undefined,
  rateLimits: {
    Type: null,
    AppRateLimit: null,
    AppRateLimitCount: null,
    MethodRateLimit: undefined,
    MethodRatelimitCount: null,
    RetryAfter: 0,
    EdgeTraceId: undefined
  },
  error: AxiosError: socket hang up
      at AxiosError.from (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\axios\dist\node\axios.cjs:837:14)
      at RedirectableRequest.handleRequestError (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\axios\dist\node\axios.cjs:3087:25)
      at RedirectableRequest.emit (node:events:519:28)
      at eventHandlers.<computed> (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\follow-redirects\index.js:38:24)
      at ClientRequest.emit (node:events:519:28)
      at TLSSocket.socketOnEnd (node:_http_client:516:9)
      at TLSSocket.emit (node:events:531:35)
      at endReadableNT (node:internal/streams/readable:1696:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
      at Axios.request (C:\Users\RedFr4me\Desktop\Skoonova-Dev\NewLocal\node_modules\axios\dist\node\axios.cjs:3877:41)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    code: 'ECONNRESET',
    config: {
      transitional: [Object],
      adapter: [Array],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [Object [AxiosHeaders]],
      url: 'https://europe.api.riotgames.com/lol/match/v5/matches/by-puuid/NVzMj2r8jOWS0Gvvd_hhkV2DAndWwnHv-R3UVxyr9gkg2hu2GF47DSC8NTJLEWER4mdOfrExYxYN7Q/ids',
      method: 'get',
      params: [Object],
      data: undefined
    },
    request: Writable {
      _events: [Object],
      _writableState: [WritableState],
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _eventsCount: 3,
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [ClientRequest],
      _currentUrl: 'https://europe.api.riotgames.com/lol/match/v5/matches/by-puuid/NVzMj2r8jOWS0Gvvd_hhkV2DAndWwnHv-R3UVxyr9gkg2hu2GF47DSC8NTJLEWER4mdOfrExYxYN7Q/ids?count=5&queue=420&type=ranked&startTime=1713335400&endTime=1714545000',
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false
    },
    cause: Error: socket hang up
        at TLSSocket.socketOnEnd (node:_http_client:516:23)
        at TLSSocket.emit (node:events:531:35)
        at endReadableNT (node:internal/streams/readable:1696:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
      code: 'ECONNRESET'
    }
  }
}
Sansossio commented 6 months ago

this isnt an error from this library, look at this https://stackoverflow.com/a/16995223