Skip to content

E-connection reset error on getInitialProps when requestion from server. #9006

Closed
@mnksingh1996

Description

@mnksingh1996

Hi,
I am trying to send request to the below api:
https://stagecore.mentorz.com:8443/mentorz/api/v3/user/0/trendingmentors

And I am sometimes getting ECONNRESET error when requesting the api from server. But it is not replicating when calling from client(browser) or postman.
Also Sometimes the same thing works. The api works 6 out of 10 times on page refresh.
I have tried increasing timeout of node.js and switching networks and whatnot and nothing seems to work. Please find below the stack trace I am getting from axios error object.

{ name: 'Error',
  message: 'read ECONNRESET',
  stack:
   'Error: read ECONNRESET\n    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)',
  toJSON: [Function],
  isAxiosError: true,
  response: undefined,
  request:
   { _currentUrl:
      'https://stagecore.mentorz.com:8443/mentorz/api/v3/user/0/trendingmentors?offset=0&limit=10',
     _currentRequest:
      { _redirectable: '[Circular]',
        maxHeadersCount: null,
        parser: null,
        upgradeOrConnect: false,
        timeoutCb: null,
        aborted: undefined,
        res: null,
        _ended: false,
        path: '/mentorz/api/v3/user/0/trendingmentors?offset=0&limit=10',
        method: 'GET',
        timeout: undefined,
        socketPath: undefined,
        agent: [Object],
        _onPendingData: [Function: noopPendingOutput],
        _header:
         'GET /mentorz/api/v3/user/0/trendingmentors?offset=0&limit=10 HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36\r\nHost: stagecore.mentorz.com:8443\r\nConnection: close\r\n\r\n',
        connection: [Object],
        socket: [Object],
        _headerSent: true,
        finished: true,
        _trailer: '',
        _hasBody: true,
        _contentLength: 0,
        _removedTE: false,
        _removedContLen: false,
        _removedConnection: false,
        sendDate: false,
        useChunkedEncodingByDefault: false,
        shouldKeepAlive: false,
        chunkedEncoding: false,
        _last: true,
        writable: true,
        outputSize: 0,
        outputCallbacks: [],
        outputEncodings: [],
        output: [],
        _maxListeners: undefined,
        _eventsCount: 6,
        _events: [Object] },
     _onNativeResponse: [Function],
     _requestBodyBuffers: [],
     _requestBodyLength: 0,
     _redirects: [],
     _redirectCount: 0,
     _options:
      { search: '?offset=0&limit=10',
        pathname: '/mentorz/api/v3/user/0/trendingmentors',
        nativeProtocols: [Object],
        port: '8443',
        hostname: 'stagecore.mentorz.com',
        auth: undefined,
        agent: undefined,
        headers: [Object],
        method: 'GET',
        path: '/mentorz/api/v3/user/0/trendingmentors?offset=0&limit=10',
        maxBodyLength: 10485760,
        maxRedirects: 21,
        protocol: 'https:' },
     _maxListeners: undefined,
     _eventsCount: 2,
     _events:
      { error: [Function: handleRequestError],
        response: [Function: handleResponse] },
     writable: true,
     _writableState:
      { corkedRequestsFree: [Object],
        bufferedRequestCount: 0,
        autoDestroy: false,
        emitClose: true,
        errorEmitted: false,
        prefinished: false,
        pendingcb: 0,
        lastBufferedRequest: null,
        bufferedRequest: null,
        writelen: 0,
        writecb: null,
        onwrite: [Function: bound onwrite],
        bufferProcessing: false,
        sync: true,
        corked: 0,
        writing: false,
        length: 0,
        defaultEncoding: 'utf8',
        decodeStrings: true,
        destroyed: false,
        finished: false,
        ended: false,
        ending: false,
        needDrain: false,
        finalCalled: false,
        highWaterMark: 16384,
        objectMode: false } },
  config:
   { data: undefined,
     validateStatus: [Function: validateStatus],
     maxContentLength: -1,
     xsrfHeaderName: 'X-XSRF-TOKEN',
     xsrfCookieName: 'XSRF-TOKEN',
     adapter: [Function: httpAdapter],
     timeout: 0,
     transformResponse: [ [Function: transformResponse] ],
     transformRequest: [ [Function: transformRequest] ],
     baseURL: 'https://stagecore.mentorz.com:8443/mentorz/api',
     headers:
      { 'user-agent':
         'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
        Accept: 'application/json, text/plain, */*' },
     params: { limit: 10, offset: 0 },
     method: 'get',
     url:
      'https://stagecore.mentorz.com:8443/mentorz/api/v3/user/0/trendingmentors' },
  syscall: 'read',
  code: 'ECONNRESET',
  errno: 'ECONNRESET' }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions