StefanIndustries / HomeyAsusWRT

View your AsusWRT network status and connected devices from Homey
GNU General Public License v3.0
2 stars 3 forks source link

[BUG] Tokenreceived includes is not a function #13

Closed StefanIndustries closed 1 year ago

StefanIndustries commented 2 years ago

---- stdout ---- [log] 2022-06-18 22:29:00 [AsusWRTApp] AsusWRTApp has been initialized [log] 2022-06-18 22:29:00 [ManagerDrivers] [Driver:asus-router] AsusRouterDriver has been initialized [log] 2022-06-18 22:29:24 [ManagerDrivers] [Driver:asus-router] starting a new pair session [log] 2022-06-18 22:29:33 [ManagerDrivers] [Driver:asus-router] pair: router_ip_confirmed [log] 2022-06-18 22:29:33 [ManagerDrivers] [Driver:asus-router] 192.168.7.1 [log] 2022-06-18 22:29:33 [ManagerDrivers] [Driver:asus-router] http://192.168.7.1/ [log] 2022-06-18 22:29:59 [ManagerDrivers] [Driver:asus-router] pair: login [log] 2022-06-18 22:29:59 [ManagerDrivers] [Driver:asus-router] creating client [log] 2022-06-18 22:29:59 [ManagerDrivers] [Driver:asus-router] failed to login [log] 2022-06-18 22:29:59 [ManagerDrivers] [Driver:asus-router] Error: connect ECONNREFUSED 192.168.7.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '192.168.7.1', port: 80, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [Function: httpAdapter], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 10000, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'asusrouter-Android-DUTUtil-1.0.0.3.58-163', 'Content-Length': 68 }, baseURL: 'http://192.168.7.1/', method: 'post', url: '/login.cgi', data: 'login_authorization=dmFsaGFsbHJvdXRlcl9hZG1pbjpxbTBsaEFDcURxTDcqdVJ3', signal: AbortSignal { aborted: false } }, request: 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,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError],
  socket: [Array]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: 10485760,
  protocol: 'http:',
  path: '/login.cgi',
  method: 'POST',
  headers: [Object],
  agent: undefined,
  agents: [Object],
  auth: undefined,
  hostname: '192.168.7.1',
  port: null,
  nativeProtocols: [Object],
  pathname: '/login.cgi'
},
_ended: false,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 68,
_requestBodyBuffers: [ [Object] ],
_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: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  _contentLength: null,
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  socket: [Socket],
  _header: 'POST /login.cgi HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: application/x-www-form-urlencoded\r\n' +
    'User-Agent: asusrouter-Android-DUTUtil-1.0.0.3.58-163\r\n' +
    'Content-Length: 68\r\n' +
    'Host: 192.168.7.1\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/login.cgi',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: '192.168.7.1',
  protocol: 'http:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://192.168.7.1/login.cgi',
_timeout: null,
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] } [log] 2022-06-18 22:37:39 [ManagerDrivers] [Driver:asus-router] starting a new pair session [log] 2022-06-18 22:37:51 [ManagerDrivers] [Driver:asus-router] pair: router_ip_confirmed [log] 2022-06-18 22:37:51 [ManagerDrivers] [Driver:asus-router] 192.168.7.1 [log] 2022-06-18 22:37:51 [ManagerDrivers] [Driver:asus-router] http://192.168.7.1/ [log] 2022-06-18 22:38:09 [ManagerDrivers] [Driver:asus-router] pair: login [log] 2022-06-18 22:38:09 [ManagerDrivers] [Driver:asus-router] creating client [log] 2022-06-18 22:38:09 [ManagerDrivers] [Driver:asus-router] failed to login [log] 2022-06-18 22:38:09 [ManagerDrivers] [Driver:asus-router] Error: connect ECONNREFUSED 192.168.7.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '192.168.7.1', port: 80, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [Function: httpAdapter], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 10000, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'asusrouter-Android-DUTUtil-1.0.0.3.58-163', 'Content-Length': 68 }, baseURL: 'http://192.168.7.1/', method: 'post', url: '/login.cgi', data: 'login_authorization=dmFsaGFsbHJvdXRlcl9hZG1pbjpxbTBsaEFDcURxTDcqdVJ3', signal: AbortSignal { aborted: false } }, request: 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,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError],
  socket: [Array]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: 10485760,
  protocol: 'http:',
  path: '/login.cgi',
  method: 'POST',
  headers: [Object],
  agent: undefined,
  agents: [Object],
  auth: undefined,
  hostname: '192.168.7.1',
  port: null,
  nativeProtocols: [Object],
  pathname: '/login.cgi'
},
_ended: false,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 68,
_requestBodyBuffers: [ [Object] ],
_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: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  _contentLength: null,
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  socket: [Socket],
  _header: 'POST /login.cgi HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: application/x-www-form-urlencoded\r\n' +
    'User-Agent: asusrouter-Android-DUTUtil-1.0.0.3.58-163\r\n' +
    'Content-Length: 68\r\n' +
    'Host: 192.168.7.1\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/login.cgi',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: '192.168.7.1',
  protocol: 'http:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://192.168.7.1/login.cgi',
_timeout: null,
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] } [log] 2022-06-18 22:44:42 [ManagerDrivers] [Driver:asus-router] starting a new pair session [log] 2022-06-18 22:44:53 [ManagerDrivers] [Driver:asus-router] pair: router_ip_confirmed [log] 2022-06-18 22:44:53 [ManagerDrivers] [Driver:asus-router] 192.168.7.1 [log] 2022-06-18 22:44:53 [ManagerDrivers] [Driver:asus-router] http://192.168.7.1/ [log] 2022-06-18 22:45:18 [ManagerDrivers] [Driver:asus-router] pair: login [log] 2022-06-18 22:45:18 [ManagerDrivers] [Driver:asus-router] creating client [log] 2022-06-18 22:45:18 [ManagerDrivers] [Driver:asus-router] failed to login [log] 2022-06-18 22:45:18 [ManagerDrivers] [Driver:asus-router] Error: connect ECONNREFUSED 192.168.7.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '192.168.7.1', port: 80, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [Function: httpAdapter], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 10000, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'asusrouter-Android-DUTUtil-1.0.0.3.58-163', 'Content-Length': 68 }, baseURL: 'http://192.168.7.1/', method: 'post', url: '/login.cgi', data: 'login_authorization=dmFsaGFsbHJvdXRlcl9hZG1pbjpxbTBsaEFDcURxTDcqdVJ3', signal: AbortSignal { aborted: false } }, request: 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,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError],
  socket: [Array]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: 10485760,
  protocol: 'http:',
  path: '/login.cgi',
  method: 'POST',
  headers: [Object],
  agent: undefined,
  agents: [Object],
  auth: undefined,
  hostname: '192.168.7.1',
  port: null,
  nativeProtocols: [Object],
  pathname: '/login.cgi'
},
_ended: false,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 68,
_requestBodyBuffers: [ [Object] ],
_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: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  _contentLength: null,
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  socket: [Socket],
  _header: 'POST /login.cgi HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: application/x-www-form-urlencoded\r\n' +
    'User-Agent: asusrouter-Android-DUTUtil-1.0.0.3.58-163\r\n' +
    'Content-Length: 68\r\n' +
    'Host: 192.168.7.1\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/login.cgi',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: '192.168.7.1',
  protocol: 'http:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://192.168.7.1/login.cgi',
_timeout: null,
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] }

---- stderr ----

StefanIndustries commented 2 years ago

Also occurs when HTTPS is enabled on the router.

StefanIndustries commented 1 year ago

We cannot work with routers when HTTPS is enabled. Add warning that router should be configured in HTTP mode.