nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

ECONNREFUSED again, none of the fixes from other issues helped me #4428

Closed happy-man closed 5 months ago

happy-man commented 5 months ago

Version

v16.20.2

Platform

Microsoft Windows NT 10.0.22631.0 x64

Subsystem

No response

What steps will reproduce the bug?

Hello community. I know this question has been asked a lot of times, but as topic says - none helped me.

Here is the simple code I run:

import axios from 'axios';
import tickers from './tickers.json' assert { type: 'json' };

for (let i = 0; i < tickers.length; i++) {
    axios.get(`http://127.0.0.1:8080/Register?symbol=${tickers[i]}&feedtype=L1`);
}

tickers.json is the JSON array file which contain stock market tickers:

[
    "SBSW.NY",
    "NIO.NY",
    "TSM.NY",
    "DNA.NY",
    "SQM.NY",
    "FRO.NY",
    "SMR.NY",
    "QS.NY",
    "RDDT.NY",
    "NET.NY",
    "VRT.NY",
    "CRH.NY",
    "SNOW.NY",
    "NOK.NY",
    "ALV.NY",
    "KSS.NY",
    "JOBY.NY",
    ...and so on, there could be 100s of it
]

When I run this code I get the error ECONNREFUSED. Server is a trading platform which provides API hosted at http://127.0.0.1:8080 so client can get some data or register to get UDP updates. Server is running during the time I run the code, I can confirm it just by onening 127.0.0.1:8080 in the browser. Host in the request url is set to 127.0.0.1:8080 not localhost. Tried it with node 16, 17, 18, 20, latest and getting the same result always.

Below is code i run for node versions which support fetch:

import tickers from './tickers.json' with { type: 'json' };

tickers.forEach(t => {
    fetch(`http://127.0.0.1:8080/Register?symbol=${t}&feedtype=L1`);
});

and the result:

node:internal/deps/undici/undici:13193
      Error.captureStackTrace(err);
            ^

TypeError: fetch failed
    at node:internal/deps/undici/undici:13193:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: Error: connect ECONNREFUSED 127.0.0.1:8080
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16) {
    errno: -4078,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 8080
  }
}

I tried to run the same requests using curl and python and it work well with the same inputs:

import grequests

urls = [
    'http://127.0.0.1:8080/Register?symbol=SBSW.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NIO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=TSM.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SQM.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=DNA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=QS.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SMR.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=RDDT.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=VRT.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NET.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SNOW.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=CRH.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=FRO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=ALV.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=KSS.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=JOBY.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=AMC.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=DELL.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NOK.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=STLA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=CVNA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=DNMR.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=CCL.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=ACHR.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=M.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SQ.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NCLH.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BMY.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=PATH.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=F.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=IONQ.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SHOP.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=RBLX.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=PFE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=UBER.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=VZ.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=CHPT.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NKE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=TEVA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=WMT.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SNAP.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=W.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=MPW.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=MO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=GM.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=GME.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=DIS.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=T.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BTI.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=ZK.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NU.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=CHWY.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BAC.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=U.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=AI.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=PLTR.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NVO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=TWLO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=TDOC.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=PINS.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=PHG.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=VALE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=ZIM.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=ALC.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=RIO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=FCX.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=CLF.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SPCE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=AG.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=FUBO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=FREY.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=ORCL.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BHP.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=X.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=SPOT.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=DAL.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=MP.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=KO.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=RCL.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=NOVA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=AA.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=BUD.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=GE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=RACE.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=EURN.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=C.NY&feedtype=L1',
    'http://127.0.0.1:8080/Register?symbol=JMIA.NY&feedtype=L1'
]

def exception_handler(request, exception):
    print("Request failed")

rs = (grequests.get(u) for u in urls)
print(grequests.map(rs, exception_handler))

The result: image

Hopefully I explained everything in details. If you need some more - I'm open to provide anything. I have never faced this issue before and this feels really annoying.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^
AxiosError: connect ECONNREFUSED 127.0.0.1:8080
    at Function.AxiosError.from (file:///C:/Users/%D0%A0%D0%BE%D1%81%D1%82%D0%B8%D1%81%D0%BB%D0%B0%D0%B2/Desktop/early-imbalance-stock-trading/node_modules/axios/lib/core/AxiosError.js:89:14)
    at RedirectableRequest.handleRequestError (file:///C:/Users/%D0%A0%D0%BE%D1%81%D1%82%D0%B8%D1%81%D0%BB%D0%B0%D0%B2/Desktop/early-imbalance-stock-trading/node_modules/axios/lib/adapters/http.js:610:25)
    at RedirectableRequest.emit (node:events:513:28)
    at ClientRequest.eventHandlers.<computed> (C:\Users\Ростислав\Desktop\early-imbalance-stock-trading\node_modules\follow-redirects\index.js:38:24)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketErrorListener (node:_http_client:494:9)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at Axios.request (file:///C:/Users/%D0%A0%D0%BE%D1%81%D1%82%D0%B8%D1%81%D0%BB%D0%B0%D0%B2/Desktop/early-imbalance-stock-trading/node_modules/axios/lib/core/Axios.js:45:41)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  port: 8080,
  address: '127.0.0.1',
  syscall: 'connect',
  code: 'ECONNREFUSED',
  errno: -4078,
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [ 'xhr', 'http', 'fetch' ],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: {
      FormData: [Function: FormData] {
        LINE_BREAK: '\r\n',
        DEFAULT_CONTENT_TYPE: 'application/octet-stream'
      },
      Blob: null
    },
    validateStatus: [Function: validateStatus],
    headers: Object [AxiosHeaders] {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': undefined,
      'User-Agent': 'axios/1.7.2',
      'Accept-Encoding': 'gzip, compress, deflate, br'
    },
    method: 'get',
    url: 'http://127.0.0.1:8080/Register?symbol=BTI.NY&feedtype=L1',
    data: undefined
  },
  request: <ref *2> 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]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: Infinity,
      protocol: 'http:',
      path: '/Register?symbol=BTI.NY&feedtype=L1',
      method: 'GET',
      headers: [Object: null prototype] {
        Accept: 'application/json, text/plain, */*',
        'User-Agent': 'axios/1.7.2',
        'Accept-Encoding': 'gzip, compress, deflate, br'
      },
      agents: { http: undefined, https: undefined },
      auth: undefined,
      family: undefined,
      beforeRedirect: [Function: dispatchBeforeRedirect],
      beforeRedirects: { proxy: [Function: beforeRedirect] },
      hostname: '127.0.0.1',
      port: '8080',
      agent: undefined,
      nativeProtocols: {
        'http:': {
          _connectionListener: [Function: connectionListener],
          METHODS: [
            'ACL',         'BIND',       'CHECKOUT',
            'CONNECT',     'COPY',       'DELETE',
            'GET',         'HEAD',       'LINK',
            'LOCK',        'M-SEARCH',   'MERGE',
            'MKACTIVITY',  'MKCALENDAR', 'MKCOL',
            'MOVE',        'NOTIFY',     'OPTIONS',
            'PATCH',       'POST',       'PROPFIND',
            'PROPPATCH',   'PURGE',      'PUT',
            'REBIND',      'REPORT',     'SEARCH',
            'SOURCE',      'SUBSCRIBE',  'TRACE',
            'UNBIND',      'UNLINK',     'UNLOCK',
            'UNSUBSCRIBE'
          ],
          STATUS_CODES: {
            '100': 'Continue',
            '101': 'Switching Protocols',
            '102': 'Processing',
            '103': 'Early Hints',
            '200': 'OK',
            '201': 'Created',
            '202': 'Accepted',
            '203': 'Non-Authoritative Information',
            '204': 'No Content',
            '205': 'Reset Content',
            '206': 'Partial Content',
            '207': 'Multi-Status',
            '208': 'Already Reported',
            '226': 'IM Used',
            '300': 'Multiple Choices',
            '301': 'Moved Permanently',
            '302': 'Found',
            '303': 'See Other',
            '304': 'Not Modified',
            '305': 'Use Proxy',
            '307': 'Temporary Redirect',
            '308': 'Permanent Redirect',
            '400': 'Bad Request',
            '401': 'Unauthorized',
            '402': 'Payment Required',
            '403': 'Forbidden',
            '404': 'Not Found',
            '405': 'Method Not Allowed',
            '406': 'Not Acceptable',
            '407': 'Proxy Authentication Required',
            '408': 'Request Timeout',
            '409': 'Conflict',
            '410': 'Gone',
            '411': 'Length Required',
            '412': 'Precondition Failed',
            '413': 'Payload Too Large',
            '414': 'URI Too Long',
            '415': 'Unsupported Media Type',
            '416': 'Range Not Satisfiable',
            '417': 'Expectation Failed',
            '418': "I'm a Teapot",
            '421': 'Misdirected Request',
            '422': 'Unprocessable Entity',
            '423': 'Locked',
            '424': 'Failed Dependency',
            '425': 'Too Early',
            '426': 'Upgrade Required',
            '428': 'Precondition Required',
            '429': 'Too Many Requests',
            '431': 'Request Header Fields Too Large',
            '451': 'Unavailable For Legal Reasons',
            '500': 'Internal Server Error',
            '501': 'Not Implemented',
            '502': 'Bad Gateway',
            '503': 'Service Unavailable',
            '504': 'Gateway Timeout',
            '505': 'HTTP Version Not Supported',
            '506': 'Variant Also Negotiates',
            '507': 'Insufficient Storage',
            '508': 'Loop Detected',
            '509': 'Bandwidth Limit Exceeded',
            '510': 'Not Extended',
            '511': 'Network Authentication Required'
          },
          Agent: [Function: Agent] { defaultMaxSockets: Infinity },
          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],
          setMaxIdleHTTPParsers: [Function: setMaxIdleHTTPParsers],
          maxHeaderSize: [Getter],
          globalAgent: [Getter/Setter]
        },
        'https:': {
          Agent: [Function: Agent],
          globalAgent: Agent {
            _events: [Object: null prototype],
            _eventsCount: 2,
            _maxListeners: undefined,
            defaultPort: 443,
            protocol: 'https:',
            options: [Object: null prototype],
            requests: [Object: null prototype] {},
            sockets: [Object: null prototype] {},
            freeSockets: [Object: null prototype] {},
            keepAliveMsecs: 1000,
            keepAlive: false,
            maxSockets: Infinity,
            maxFreeSockets: 256,
            scheduling: 'lifo',
            maxTotalSockets: Infinity,
            totalSocketCount: 0,
            maxCachedSessions: 100,
            _sessionCache: [Object],
            [Symbol(kCapture)]: false
          },
          Server: [Function: Server],
          createServer: [Function: createServer],
          get: [Function: get],
          request: [Function: request]
        }
      },
      pathname: '/Register',
      search: '?symbol=BTI.NY&feedtype=L1'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 0,
    _requestBodyBuffers: [],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: <ref *1> 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,
      strictContentLength: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: false,
      socket: Socket {
        connecting: false,
        _hadError: true,
        _parent: null,
        _host: null,
        _closeAfterHandlingError: false,
        _readableState: ReadableState {
          objectMode: false,
          highWaterMark: 16384,
          buffer: BufferList { head: null, tail: null, length: 0 },
          length: 0,
          pipes: [],
          flowing: true,
          ended: false,
          endEmitted: false,
          reading: true,
          constructed: true,
          sync: false,
          needReadable: true,
          emittedReadable: false,
          readableListening: false,
          resumeScheduled: false,
          errorEmitted: true,
          emitClose: false,
          autoDestroy: true,
          destroyed: true,
          errored: Error: connect ECONNREFUSED 127.0.0.1:8080
              at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
            errno: -4078,
            code: 'ECONNREFUSED',
            syscall: 'connect',
            address: '127.0.0.1',
            port: 8080
          },
          closed: true,
          closeEmitted: true,
          defaultEncoding: 'utf8',
          awaitDrainWriters: null,
          multiAwaitDrain: false,
          readingMore: false,
          dataEmitted: false,
          decoder: null,
          encoding: null,
          [Symbol(kPaused)]: false
        },
        _events: [Object: null prototype] {
          end: [Function: onReadableStreamEnd],
          connect: [ [Function], [Function], [Function] ],
          free: [Function: onFree],
          close: [ [Function: onClose], [Function: socketCloseListener] ],
          timeout: [Function: onTimeout],
          agentRemove: [Function: onRemove],
          error: [Function: socketErrorListener],
          drain: [Function: ondrain]
        },
        _eventsCount: 8,
        _maxListeners: undefined,
        _writableState: WritableState {
          objectMode: false,
          highWaterMark: 16384,
          finalCalled: false,
          needDrain: false,
          ending: false,
          ended: false,
          finished: false,
          destroyed: true,
          decodeStrings: false,
          defaultEncoding: 'utf8',
          length: 207,
          writing: true,
          corked: 0,
          sync: false,
          bufferProcessing: false,
          onwrite: [Function: bound onwrite],
          writecb: [Function: bound onFinish],
          writelen: 207,
          afterWriteTickInfo: null,
          buffered: [],
          bufferedIndex: 0,
          allBuffers: true,
          allNoop: true,
          pendingcb: 1,
          constructed: true,
          prefinished: false,
          errorEmitted: true,
          emitClose: false,
          autoDestroy: true,
          errored: Error: connect ECONNREFUSED 127.0.0.1:8080
              at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
            errno: -4078,
            code: 'ECONNREFUSED',
            syscall: 'connect',
            address: '127.0.0.1',
            port: 8080
          },
          closed: true,
          closeEmitted: true,
          [Symbol(kOnFinished)]: []
        },
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: 'GET /Register?symbol=BTI.NY&feedtype=L1 HTTP/1.1\r\n' +
          'Accept: application/json, text/plain, */*\r\n' +
          'User-Agent: axios/1.7.2\r\n' +
          'Accept-Encoding: gzip, compress, deflate, br\r\n' +
          'Host: 127.0.0.1:8080\r\n' +
          'Connection: close\r\n' +
          '\r\n',
        _pendingEncoding: 'latin1',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Circular *1],
        [Symbol(async_id_symbol)]: 444,
        [Symbol(kHandle)]: null,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBuffer)]: null,
        [Symbol(kBufferCb)]: null,
        [Symbol(kBufferGen)]: null,
        [Symbol(kCapture)]: false,
        [Symbol(kSetNoDelay)]: false,
        [Symbol(kSetKeepAlive)]: true,
        [Symbol(kSetKeepAliveInitialDelay)]: 60,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0
      },
      _header: 'GET /Register?symbol=BTI.NY&feedtype=L1 HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/1.7.2\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: 127.0.0.1:8080\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: 80,
        protocol: 'http:',
        options: [Object: null prototype] { path: null },
        requests: [Object: null prototype] {},
        sockets: [Object: null prototype] {
          '127.0.0.1:8080:': [
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket],
            [Socket], [Socket], [Socket], [Socket], [Socket], [Socket]
          ]
        },
        freeSockets: [Object: null prototype] {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        scheduling: 'lifo',
        maxTotalSockets: Infinity,
        totalSocketCount: 90,
        [Symbol(kCapture)]: false
      },
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/Register?symbol=BTI.NY&feedtype=L1',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '127.0.0.1',
      protocol: 'http:',
      _redirectable: [Circular *2],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kEndCalled)]: true,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype] {
        accept: [ 'Accept', 'application/json, text/plain, */*' ],
        'user-agent': [ 'User-Agent', 'axios/1.7.2' ],
        'accept-encoding': [ 'Accept-Encoding', 'gzip, compress, deflate, br' ],
        host: [ 'Host', '127.0.0.1:8080' ]
      },
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'http://127.0.0.1:8080/Register?symbol=BTI.NY&feedtype=L1',
    [Symbol(kCapture)]: false
  },
  cause: Error: connect ECONNREFUSED 127.0.0.1:8080
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
    errno: -4078,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 8080
  }
}

Additional information

No response

RedYetiDev commented 5 months ago

Hi! If you don't mind, could you edit your issue to include a minimal reproducible example (without the use to dependencies?).

StefanStojanovic commented 5 months ago

Also, please keep in mind that Node.js v16 is no longer supported, so if possible, please try upgrading to at least v18.

happy-man commented 5 months ago

Hi! If you don't mind, could you edit your issue to include a minimal reproducible example (without the use to dependencies?).

Hello! It's kind of hard to reproduce, because it makes requests to the trading platform server, which others won't be able to run at their local machines easily. But it seems there could be the problem with the server itself, even when it responses 200 in the python example. I'm investigating on it, will keep it updated. Thanks for the interest to the problem.

RedYetiDev commented 5 months ago

I'm closing this issue, as you said it may be a problem with the server.

If you can reproduce with a Node.js client and server, please open a new issue with a reproducible example.