fastify / fastify-soap-client

Fastify plugin for a SOAP client
MIT License
10 stars 5 forks source link

Issue with corporate proxy/vpn #82

Closed MTD-Telus closed 4 months ago

MTD-Telus commented 4 months ago

Prerequisites

Fastify version

4.26.2

Plugin version

^2.2.0

Node.js version

^20

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

20.04

Description

There seems to be an issue when trying to use this with a vpn/proxy. My application run without a problem when off vpn and no proxy env variables. But the second I'm on the vpn I keep on getting ECONNRESET.

When on VPN+proxy I can curl the WSDL url without any issue

Ive tried something like this

  fastify.register(fastifySoapClient, {
    url: 'test?WSDL',
    options: {
        rejectUnauthorized: false,
        forceSoap12Headers: true ,
        wsdl_options: {proxy:{
          protocol: 'corporate protcol', 
          host: 'corporate host',
          port: corporate port,
        }}
    }
  })

Error Output

AxiosError: socket hang up
    at AxiosError.from (/home/mtd/xxxx/xxxx/app/node_modules/axios/dist/node/axios.cjs:836:14)
    at RedirectableRequest.handleRequestError (/home/mtd/xxxx/xxxx/app/node_modules/axios/dist/node/axios.cjs:3086:25)
    at RedirectableRequest.emit (node:events:518:28)
    at eventHandlers.<computed> (/home/mtd/xxxx/xxxx/app/node_modules/follow-redirects/index.js:38:24)
    at ClientRequest.emit (node:events:518:28)
    at Socket.socketOnEnd (node:_http_client:524:9)
    at Socket.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
    at Axios.request (/home/mtd/xxxx/xxxx/app/node_modules/axios/dist/node/axios.cjs:3876:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ECONNRESET',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [ 'xhr', 'http' ],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [Function: transformResponse],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function], Blob: [class Blob] },
    validateStatus: null,
    headers: Object [AxiosHeaders] {
      Accept: 'text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8',
      'Content-Type': undefined,
      'User-Agent': 'node-soap/0.45.0',
      'Accept-Encoding': 'none',
      'Accept-Charset': 'utf-8',
      Connection: 'close',
      Host: 'alarmadmin.alarm.com'
    },
    url: 'https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx?WSDL',
    method: 'get',
    data: null
  },
  request: <ref *1> Writable {
    _events: {
      close: undefined,
      error: [Function: handleRequestError],
      prefinish: undefined,
      finish: undefined,
      drain: undefined,
      response: [Function: handleResponse],
      socket: [Function: handleRequestSocket]
    },
    _writableState: WritableState {
      highWaterMark: 16384,
      length: 0,
      corked: 0,
      onwrite: [Function: bound onwrite],
      writelen: 0,
      bufferedIndex: 0,
      pendingcb: 0,
      [Symbol(kState)]: 17580812,
      [Symbol(kBufferedValue)]: null
    },
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: Infinity,
      protocol: 'http:',
      path: 'https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx?WSDL',
      method: 'GET',
      headers: [Object: null prototype],
      agents: [Object],
      auth: undefined,
      family: undefined,
      beforeRedirect: [Function: dispatchBeforeRedirect],
      beforeRedirects: [Object],
      hostname: 'myproxyurl',
      port: '8080',
      agent: undefined,
      nativeProtocols: [Object],
      pathname: 'https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx',
      search: '?WSDL'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 0,
    _requestBodyBuffers: [],
    _eventsCount: 3,
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      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],
      _header: 'GET https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx?WSDL HTTP/1.1\r\n' +
        'Accept: text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8\r\n' +
        'User-Agent: node-soap/0.45.0\r\n' +
        'Accept-Encoding: none\r\n' +
        'Accept-Charset: utf-8\r\n' +
        'Connection: close\r\n' +
        'host: alarmadmin.alarm.com\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: 'https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx?WSDL',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: [Function: emitRequestTimeout],
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'myproxyurl',
      protocol: 'http:',
      _redirectable: [Circular *1],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx?WSDL',
    [Symbol(shapeMode)]: true,
    [Symbol(kCapture)]: false
  },
  cause: Error: socket hang up
      at Socket.socketOnEnd (node:_http_client:524:23)
      at Socket.emit (node:events:530:35)
      at endReadableNT (node:internal/streams/readable:1696:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    code: 'ECONNRESET'
  }
}

Link to code that reproduces the bug

No response

Expected Behavior

No response

mcollina commented 4 months ago

This has nothing to do with this module, please report it to soap.