[solved]Server error. Request Timeout.. Paypal clone

This is the error i get when i run my server. it starts off well and after few seconds gives this error

C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\@moralisweb3\common-core\lib\cjs\index.cjs:1217
        return new CoreError({
               ^

MoralisError [Moralis SDK Core Error]: [C0006] Request failed: timeout of 20000ms exceeded
    at RequestController.makeError (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\@moralisweb3\common-core\lib\cjs\index.cjs:1217:16)
    at RequestController.<anonymous> (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\@moralisweb3\common-core\lib\cjs\index.cjs:1187:38)
    at step (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\@moralisweb3\common-core\lib\cjs\index.cjs:81:23)
    at Object.throw (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\@moralisweb3\common-core\lib\cjs\index.cjs:62:53)
    at rejected (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\@moralisweb3\common-core\lib\cjs\index.cjs:53:65)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at listOnTimeout (node:internal/timers:528:9)
    at processTimers (node:internal/timers:502:7) {
  isMoralisError: true,
  code: 'C0006',
  details: undefined,
  [cause]: AxiosError: timeout of 20000ms exceeded
      at RedirectableRequest.handleRequestTimeout (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\axios\dist\node\axios.cjs:3010:16)
      at RedirectableRequest.emit (node:events:520:28)
      at Timeout.<anonymous> (C:\Users\DANIEL\Desktop\WIP Folder\coinrade\backend\node_modules\follow-redirects\index.js:169:12)
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7) {
    code: 'ECONNABORTED',
    config: {
      transitional: {
        silentJSONParsing: true,
        forcedJSONParsing: true,
        clarifyTimeoutError: false
      },
      adapter: [ 'xhr', 'http' ],
      transformRequest: [ [Function: transformRequest] ],
      transformResponse: [ [Function: transformResponse] ],
      timeout: 20000,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: Infinity,
      maxBodyLength: Infinity,
      env: {
        FormData: [Function: FormData] {
          LINE_BREAK: '\r\n',
          DEFAULT_CONTENT_TYPE: 'application/octet-stream'
        },
        Blob: null
      },
      validateStatus: [Function: validateStatus],
      headers: AxiosHeaders {
        Accept: 'application/json, text/plain, */*',
        'x-moralis-platform': 'NodeJS SDK',
        'x-moralis-platform-version': undefined,
        'x-moralis-build-target': 'node',
        'x-api-key': '432432',
        'User-Agent': 'axios/1.3.4',
        'Accept-Encoding': 'gzip, compress, deflate, br'
      },
      method: 'get',
      url: 'https://deep-index.moralis.io/api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance',
      params: { chain: '0x13881' },
      data: undefined
    },
    request: <ref *4> Writable {
      _writableState: WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: false,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        afterWriteTickInfo: null,
        buffered: [],
        bufferedIndex: 0,
        allBuffers: true,
        allNoop: true,
        pendingcb: 0,
        constructed: true,
        prefinished: false,
        errorEmitted: false,
        emitClose: true,
        autoDestroy: true,
        errored: null,
        closed: false,
        closeEmitted: false,
        [Symbol(kOnFinished)]: []
      },
      _events: [Object: null prototype] {
        response: [Function: handleResponse],
        error: [Function: handleRequestError],
        socket: [
          [Function: handleRequestSocket],
          [Function: destroyOnTimeout]
        ]
      },
      _eventsCount: 3,
      _maxListeners: undefined,
      _options: {
        maxRedirects: 21,
        maxBodyLength: Infinity,
        protocol: 'https:',
        path: '/api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance?chain=0x13881',
        method: 'GET',
        headers: [Object: null prototype] {
          Accept: 'application/json, text/plain, */*',
          'x-moralis-platform': 'NodeJS SDK',
          'x-moralis-build-target': 'node',
          'x-api-key': '43242',
          'User-Agent': 'axios/1.3.4',
          'Accept-Encoding': 'gzip, compress, deflate, br'
        },
        agents: { http: undefined, https: undefined },
        auth: undefined,
        beforeRedirect: [Function: dispatchBeforeRedirect],
        beforeRedirects: { proxy: [Function: beforeRedirect] },
        hostname: 'deep-index.moralis.io',
        port: '',
        agent: undefined,
        nativeProtocols: {
          'http:': {
            _connectionListener: [Function: connectionListener],
            METHODS: [Array],
            STATUS_CODES: [Object],
            Agent: [Function],
            ClientRequest: [Function: ClientRequest],
            IncomingMessage: [Function: IncomingMessage],
            OutgoingMessage: [Function: OutgoingMessage],
            Server: [Function: Server],
            ServerResponse: [Function: ServerResponse],
            createServer: [Function: createServer],
            validateHeaderName: [Function: __node_internal_],
            validateHeaderValue: [Function: __node_internal_],
            get: [Function: get],
            request: [Function: request],
            maxHeaderSize: [Getter],
            globalAgent: [Getter/Setter]
          },
          'https:': {
            Agent: [Function: Agent],
            globalAgent: [Agent],
            Server: [Function: Server],
            createServer: [Function: createServer],
            get: [Function: get],
            request: [Function: request]
          }
        },
        pathname: '/api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance',
        search: '?chain=0x13881'
      },
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: <ref *2> ClientRequest {
        _events: [Object: null prototype] {
          response: [Function: bound onceWrapper] {
            listener: [Function (anonymous)]
          },
          abort: [Function (anonymous)],
          aborted: [Function (anonymous)],
          connect: [Function (anonymous)],
          error: [Function (anonymous)],
          socket: [Function (anonymous)],
          timeout: [Function (anonymous)]
        },
        _eventsCount: 7,
        _maxListeners: undefined,
        outputData: [],
        outputSize: 0,
        writable: true,
        destroyed: false,
        _last: true,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        maxRequestsOnConnectionReached: false,
        _defaultKeepAlive: true,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        _closed: false,
        socket: <ref *1> TLSSocket {
          _tlsOptions: {
            allowHalfOpen: undefined,
            pipe: false,
            secureContext: [SecureContext],
            isServer: false,
            requestCert: true,
            rejectUnauthorized: true,
            session: [Buffer [Uint8Array]],
            ALPNProtocols: undefined,
            requestOCSP: undefined,
            enableTrace: undefined,
            pskCallback: undefined,
            highWaterMark: undefined,
            onread: undefined,
            signal: undefined
          },
          _secureEstablished: false,
          _securePending: false,
          _newSessionPending: false,
          _controlReleased: true,
          secureConnecting: true,
          _SNICallback: null,
          servername: null,
          alpnProtocol: null,
          authorized: false,
          authorizationError: null,
          encrypted: true,
          _events: [Object: null prototype] {
            close: [Array],
            end: [Array],
            newListener: [Function: keylogNewListener],
            connect: [Array],
            secure: [Function: onConnectSecure],
            session: [Function (anonymous)],
            free: [Function: onFree],
            timeout: [Array],
            agentRemove: [Function: onRemove],
            error: [Function: socketErrorListener],
            data: [Function: socketOnData],
            drain: [Function: ondrain]
          },
          _eventsCount: 12,
          connecting: true,
          _hadError: false,
          _parent: null,
          _host: 'deep-index.moralis.io',
          _readableState: ReadableState {
            objectMode: false,
            highWaterMark: 16384,
            buffer: [BufferList],
            length: 0,
            pipes: [],
            flowing: true,
            ended: false,
            endEmitted: false,
            reading: true,
            constructed: true,
            sync: false,
            needReadable: true,
            emittedReadable: false,
            readableListening: false,
            resumeScheduled: false,
            errorEmitted: false,
            emitClose: false,
            autoDestroy: true,
            destroyed: false,
            errored: null,
            closed: false,
            closeEmitted: false,
            defaultEncoding: 'utf8',
            awaitDrainWriters: null,
            multiAwaitDrain: false,
            readingMore: false,
            dataEmitted: false,
            decoder: null,
            encoding: null,
            [Symbol(kPaused)]: false
          },
          _maxListeners: undefined,
          _writableState: WritableState {
            objectMode: false,
            highWaterMark: 16384,
            finalCalled: false,
            needDrain: false,
            ending: false,
            ended: false,
            finished: false,
            destroyed: false,
            decodeStrings: false,
            defaultEncoding: 'utf8',
            length: 390,
            writing: true,
            corked: 0,
            sync: false,
            bufferProcessing: false,
            onwrite: [Function: bound onwrite],
            writecb: [Function: bound onFinish],
            writelen: 390,
            afterWriteTickInfo: null,
            buffered: [],
            bufferedIndex: 0,
            allBuffers: true,
            allNoop: true,
            pendingcb: 1,
            constructed: true,
            prefinished: false,
            errorEmitted: false,
            emitClose: false,
            autoDestroy: true,
            errored: null,
            closed: false,
            closeEmitted: false,
            [Symbol(kOnFinished)]: []
          },
          allowHalfOpen: false,
          _sockname: null,
          _pendingData: 'GET /api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance?chain=0x13881 HTTP/1.1\r\n' +
            'Accept: application/json, text/plain, */*\r\n' +
            'x-moralis-platform: NodeJS SDK\r\n' +
            'x-moralis-build-target: node\r\n' +
            'x-api-key: 432432\r\n' +
            'User-Agent: axios/1.3.4\r\n' +
            'Accept-Encoding: gzip, compress, deflate, br\r\n' +
            'Host: deep-index.moralis.io\r\n' +
            'Connection: close\r\n' +
            '\r\n',
          _pendingEncoding: 'latin1',
          server: undefined,
          _server: null,
          ssl: TLSWrap {
            _parent: [TCP],
            _parentWrap: undefined,
            _secureContext: [SecureContext],
            reading: false,
            onkeylog: [Function: onkeylog],
            onhandshakestart: {},
            onhandshakedone: [Function (anonymous)],
            onocspresponse: [Function: onocspresponse],
            onnewsession: [Function: onnewsessionclient],
            onerror: [Function: onerror],
            [Symbol(owner_symbol)]: [Circular *1]
          },
          _requestCert: true,
          _rejectUnauthorized: true,
          parser: HTTPParser {
            '0': null,
            '1': [Function: parserOnHeaders],
            '2': [Function: parserOnHeadersComplete],
            '3': [Function: parserOnBody],
            '4': [Function: parserOnMessageComplete],
            '5': null,
            '6': null,
            _headers: [],
            _url: '',
            socket: [Circular *1],
            incoming: null,
            outgoing: [Circular *2],
            maxHeaderPairs: 2000,
            _consumed: false,
            onIncoming: [Function: parserOnIncomingClient],
            [Symbol(resource_symbol)]: [HTTPClientAsyncResource]
          },
          _httpMessage: [Circular *2],
          timeout: 20000,
          [Symbol(res)]: TLSWrap {
            _parent: [TCP],
            _parentWrap: undefined,
            _secureContext: [SecureContext],
            reading: false,
            onkeylog: [Function: onkeylog],
            onhandshakestart: {},
            onhandshakedone: [Function (anonymous)],
            onocspresponse: [Function: onocspresponse],
            onnewsession: [Function: onnewsessionclient],
            onerror: [Function: onerror],
            [Symbol(owner_symbol)]: [Circular *1]
          },
          [Symbol(verified)]: false,
          [Symbol(pendingSession)]: null,
          [Symbol(async_id_symbol)]: 36,
          [Symbol(kHandle)]: TLSWrap {
            _parent: [TCP],
            _parentWrap: undefined,
            _secureContext: [SecureContext],
            reading: false,
            onkeylog: [Function: onkeylog],
            onhandshakestart: {},
            onhandshakedone: [Function (anonymous)],
            onocspresponse: [Function: onocspresponse],
            onnewsession: [Function: onnewsessionclient],
            onerror: [Function: onerror],
            [Symbol(owner_symbol)]: [Circular *1]
          },
          [Symbol(kSetNoDelay)]: false,
          [Symbol(lastWriteQueueSize)]: 0,
          [Symbol(timeout)]: Timeout {
            _idleTimeout: 20000,
            _idlePrev: [Timeout],
            _idleNext: [TimersList],
            _idleStart: 42622,
            _onTimeout: [Function: bound ],
            _timerArgs: undefined,
            _repeat: null,
            _destroyed: false,
            [Symbol(refed)]: false,
            [Symbol(kHasPrimitive)]: false,
            [Symbol(asyncId)]: 44,
            [Symbol(triggerId)]: 39
          },
          [Symbol(kBuffer)]: null,
          [Symbol(kBufferCb)]: null,
          [Symbol(kBufferGen)]: null,
          [Symbol(kCapture)]: false,
          [Symbol(kBytesRead)]: 0,
          [Symbol(kBytesWritten)]: 0,
          [Symbol(connect-options)]: {
            rejectUnauthorized: true,
            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',
            checkServerIdentity: [Function: checkServerIdentity],
            minDHSize: 1024,
            session: [Buffer [Uint8Array]],
            maxRedirects: 21,
            maxBodyLength: Infinity,
            protocol: 'https:',
            path: null,
            method: 'GET',
            headers: [Object: null prototype],
            agents: [Object],
            auth: undefined,
            beforeRedirect: [Function: dispatchBeforeRedirect],
            beforeRedirects: [Object],
            hostname: 'deep-index.moralis.io',
            port: 443,
            agent: undefined,
            nativeProtocols: [Object],
            pathname: '/api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance',
            search: '?chain=0x13881',
            _defaultAgent: [Agent],
            host: 'deep-index.moralis.io',
            servername: 'deep-index.moralis.io',
            _agentKey: 'deep-index.moralis.io:443:::::::::::::::::::::',
            encoding: null,
            singleUse: true
          }
        },
        _header: 'GET /api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance?chain=0x13881 HTTP/1.1\r\n' +
          'Accept: application/json, text/plain, */*\r\n' +
          'x-moralis-platform: NodeJS SDK\r\n' +
          'x-moralis-build-target: node\r\n' +
          'x-api-key: 43242\r\n' +
          'User-Agent: axios/1.3.4\r\n' +
          'Accept-Encoding: gzip, compress, deflate, br\r\n' +
          'Host: deep-index.moralis.io\r\n' +
          'Connection: close\r\n' +
          '\r\n',
        _keepAliveTimeout: 0,
        _onPendingData: [Function: nop],
        agent: Agent {
          _events: [Object: null prototype] {
            free: [Function (anonymous)],
            newListener: [Function: maybeEnableKeylog]
          },
          _eventsCount: 2,
          _maxListeners: undefined,
          defaultPort: 443,
          protocol: 'https:',
          options: [Object: null prototype] { path: null },
          requests: [Object: null prototype] {},
          sockets: [Object: null prototype] {
            'deep-index.moralis.io:443:::::::::::::::::::::': [Array]
          },
          freeSockets: [Object: null prototype] {},
          keepAliveMsecs: 1000,
          keepAlive: false,
          maxSockets: Infinity,
          maxFreeSockets: 256,
          scheduling: 'lifo',
          maxTotalSockets: Infinity,
          totalSocketCount: 2,
          maxCachedSessions: 100,
          _sessionCache: { map: [Object], list: [Array] },
          [Symbol(kCapture)]: false
        },
        socketPath: undefined,
        method: 'GET',
        maxHeaderSize: undefined,
        insecureHTTPParser: undefined,
        path: '/api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance?chain=0x13881',
        _ended: false,
        res: null,
        aborted: false,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: <ref *3> HTTPParser {
          '0': null,
          '1': [Function: parserOnHeaders],
          '2': [Function: parserOnHeadersComplete],
          '3': [Function: parserOnBody],
          '4': [Function: parserOnMessageComplete],
          '5': null,
          '6': null,
          _headers: [],
          _url: '',
          socket: <ref *1> TLSSocket {
            _tlsOptions: [Object],
            _secureEstablished: false,
            _securePending: false,
            _newSessionPending: false,
            _controlReleased: true,
            secureConnecting: true,
            _SNICallback: null,
            servername: null,
            alpnProtocol: null,
            authorized: false,
            authorizationError: null,
            encrypted: true,
            _events: [Object: null prototype],
            _eventsCount: 12,
            connecting: true,
            _hadError: false,
            _parent: null,
            _host: 'deep-index.moralis.io',
            _readableState: [ReadableState],
            _maxListeners: undefined,
            _writableState: [WritableState],
            allowHalfOpen: false,
            _sockname: null,
            _pendingData: 'GET /api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance?chain=0x13881 HTTP/1.1\r\n' +
              'Accept: application/json, text/plain, */*\r\n' +
              'x-moralis-platform: NodeJS SDK\r\n' +
              'x-moralis-build-target: node\r\n' +
              'x-api-key: 43242\r\n' +
              'User-Agent: axios/1.3.4\r\n' +
              'Accept-Encoding: gzip, compress, deflate, br\r\n' +
              'Host: deep-index.moralis.io\r\n' +
              'Connection: close\r\n' +
              '\r\n',
            _pendingEncoding: 'latin1',
            server: undefined,
            _server: null,
            ssl: [TLSWrap],
            _requestCert: true,
            _rejectUnauthorized: true,
            parser: [Circular *3],
            _httpMessage: [Circular *2],
            timeout: 20000,
            [Symbol(res)]: [TLSWrap],
            [Symbol(verified)]: false,
            [Symbol(pendingSession)]: null,
            [Symbol(async_id_symbol)]: 36,
            [Symbol(kHandle)]: [TLSWrap],
            [Symbol(kSetNoDelay)]: false,
            [Symbol(lastWriteQueueSize)]: 0,
            [Symbol(timeout)]: [Timeout],
            [Symbol(kBuffer)]: null,
            [Symbol(kBufferCb)]: null,
            [Symbol(kBufferGen)]: null,
            [Symbol(kCapture)]: false,
            [Symbol(kBytesRead)]: 0,
            [Symbol(kBytesWritten)]: 0,
            [Symbol(connect-options)]: [Object]
          },
          incoming: null,
          outgoing: [Circular *2],
          maxHeaderPairs: 2000,
          _consumed: false,
          onIncoming: [Function: parserOnIncomingClient],
          [Symbol(resource_symbol)]: HTTPClientAsyncResource {
            type: 'HTTPINCOMINGMESSAGE',
            req: [Circular *2]
          }
        },
        maxHeadersCount: null,
        reusedSocket: false,
        host: 'deep-index.moralis.io',
        protocol: 'https:',
        _redirectable: [Circular *4],
        [Symbol(kCapture)]: false,
        [Symbol(kNeedDrain)]: false,
        [Symbol(corked)]: 0,
        [Symbol(kOutHeaders)]: [Object: null prototype] {
          accept: [ 'Accept', 'application/json, text/plain, */*' ],
          'x-moralis-platform': [ 'x-moralis-platform', 'NodeJS SDK' ],
          'x-moralis-build-target': [ 'x-moralis-build-target', 'node' ],
          'x-api-key': [
            'x-api-key',
            '234234'
          ],
          'user-agent': [ 'User-Agent', 'axios/1.3.4' ],
          'accept-encoding': [ 'Accept-Encoding', 'gzip, compress, deflate, br' ],
          host: [ 'Host', 'deep-index.moralis.io' ]
        }
      },
      _currentUrl: 'https://deep-index.moralis.io/api/v2/0x1559572a045F8ec085FbAc8A80B399D23Ecfd01a/balance?chain=0x13881',
      _timeout: null,
      [Symbol(kCapture)]: false
    }
  }
}

I fixed this. It was a normal bad network

1 Like

that error means that it takes more than 20 seconds to get the response and the SDK has a timeout at 20 seconds, you can retry in case of error

how often you get this error?

whenever i switch a particular network.
Thanks, I found out

The current issue i am facing now is the Request and Pay methods.
I am not able to access the Metamask extensions. Iā€™d post the errors here