balansse / homebridge-vivint

Integrates Vivint security system with Apple Home
Other
48 stars 16 forks source link

error getting system info (502 bad gateway) #151

Open bony618 opened 2 months ago

bony618 commented 2 months ago

Mac OS monterey homebridge v1.8.4 homebridge UI v4.57.1 node.js v20.16.0

recently started occasionally getting this very long error message even though everything seems to function normally afterwards:

[8/29/2024, 12:25:08 PM] [@balansse/homebridge-vivint] Error getting system info: StatusCodeError: 502 - "\r\n502 Bad Gateway\r\n\r\n

502 Bad Gateway

\r\n
cloudflare
\r\n\r\n\r\n" at new StatusCodeError (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/errors.js:32:15) at Request.plumbing.callback (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/plumbing.js:46:31) at Request.self.callback (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:185:22) at Request.emit (node:events:519:28) at Request. (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:1154:10) at Request.emit (node:events:519:28) at IncomingMessage. (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:633:28) at IncomingMessage.emit (node:events:531:35) { statusCode: 502, error: '\r\n' + '502 Bad Gateway\r\n' + '\r\n' + '

502 Bad Gateway

\r\n' + '
cloudflare
\r\n' + '\r\n' + '\r\n', options: { url: 'https://www.vivintsky.com/api/systems/6818692529018764', headers: { Cookie: 's=33025270-effd-4f59-a628-d917492e7e35', 'Cache-Control': 'no-store' }, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: <ref *1> IncomingMessage { _events: { close: [Array], error: [Function (anonymous)], data: [Function (anonymous)], end: [Array], readable: undefined }, _readableState: ReadableState { highWaterMark: 16384, buffer: [], bufferIndex: 0, length: 0, pipes: [], awaitDrainWriters: null,

},
_maxListeners: undefined,
socket: null,
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [
  'Server',
  'cloudflare',
  'Date',
  'Thu, 29 Aug 2024 17:25:08 GMT',
  'Content-Type',
  'text/html',
  'Content-Length',
  '155',
  'Connection',
  'keep-alive',
  'CF-RAY',
  '8bae3d14fd53e25f-ORD'
],
rawTrailers: [],
joinDuplicateHeaders: undefined,
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 502,
statusMessage: 'Bad Gateway',
client: TLSSocket {
  _tlsOptions: [Object],
  _secureEstablished: true,
  _securePending: false,
  _newSessionPending: false,
  _controlReleased: true,
  secureConnecting: false,
  _SNICallback: null,
  servername: 'www.vivintsky.com',
  alpnProtocol: false,
  authorized: true,
  authorizationError: null,
  encrypted: true,
  _events: [Object: null prototype],
  _eventsCount: 9,
  connecting: false,
  _hadError: false,
  _parent: null,
  _host: 'www.vivintsky.com',
  _closeAfterHandlingError: false,
  _readableState: [ReadableState],
  _writableState: [WritableState],
  allowHalfOpen: false,
  _maxListeners: undefined,
  _sockname: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: undefined,
  _server: null,
  ssl: [TLSWrap],
  _requestCert: true,
  _rejectUnauthorized: true,
  timeout: 5000,
  parser: null,
  _httpMessage: null,
  autoSelectFamilyAttemptedAddresses: [Array],
  [Symbol(alpncallback)]: null,
  [Symbol(res)]: [TLSWrap],
  [Symbol(verified)]: true,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: -1,
  [Symbol(kHandle)]: [TLSWrap],
  [Symbol(lastWriteQueueSize)]: 0,
  [Symbol(timeout)]: Timeout {
    _idleTimeout: 5000,
    _idlePrev: [TimersList],
    _idleNext: [Timeout],
    _idleStart: 3547010,
    _onTimeout: [Function: bound ],
    _timerArgs: undefined,
    _repeat: null,
    _destroyed: false,
    [Symbol(refed)]: false,
    [Symbol(kHasPrimitive)]: false,
    [Symbol(asyncId)]: 14316,
    [Symbol(triggerId)]: 14314
  },
  [Symbol(kBuffer)]: null,
  [Symbol(kBufferCb)]: null,
  [Symbol(kBufferGen)]: null,
  [Symbol(shapeMode)]: true,
  [Symbol(kCapture)]: false,
  [Symbol(kSetNoDelay)]: false,
  [Symbol(kSetKeepAlive)]: true,
  [Symbol(kSetKeepAliveInitialDelay)]: 1,
  [Symbol(kBytesRead)]: 0,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(connect-options)]: [Object]
},
_consuming: false,
_dumped: false,
req: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 5,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: true,
  _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: true,
  socket: [TLSSocket],
  _header: 'GET /api/systems/6818692529018764 HTTP/1.1\r\n' +
    'Cookie: s=33025270-effd-4f59-a628-d917492e7e35\r\n' +
    'Cache-Control: no-store\r\n' +
    'host: www.vivintsky.com\r\n' +
    'Connection: keep-alive\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'GET',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  joinDuplicateHeaders: undefined,
  path: '/api/systems/6818692529018764',
  _ended: true,
  res: [Circular *1],
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'www.vivintsky.com',
  protocol: 'https:',
  [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
},
_eventsCount: 4,
request: Request {
  _events: [Object: null prototype],
  _eventsCount: 5,
  _maxListeners: undefined,
  headers: [Object],
  readable: true,
  writable: true,
  _qs: [Querystring],
  _auth: [Auth],
  _oauth: [OAuth],
  _multipart: [Multipart],
  _redirect: [Redirect],
  _tunnel: [Tunnel],
  _rp_resolve: [Function (anonymous)],
  _rp_reject: [Function (anonymous)],
  _rp_promise: [Promise],
  _rp_callbackOrig: undefined,
  callback: [Function (anonymous)],
  _rp_options: [Object],
  setHeader: [Function (anonymous)],
  hasHeader: [Function (anonymous)],
  getHeader: [Function (anonymous)],
  removeHeader: [Function (anonymous)],
  method: 'GET',
  localAddress: undefined,
  pool: {},
  dests: [],
  __isRequestRequest: true,
  _callback: [Function: RP$callback],
  uri: [Url],
  proxy: null,
  tunnel: true,
  setHost: true,
  originalCookieHeader: 's=33025270-effd-4f59-a628-d917492e7e35',
  _disableCookies: true,
  _jar: undefined,
  port: 443,
  host: 'www.vivintsky.com',
  path: '/api/systems/6818692529018764',
  httpModule: [Object],
  agentClass: [Function: Agent],
  agent: [Agent],
  _started: true,
  href: 'https://www.vivintsky.com/api/systems/6818692529018764',
  req: [ClientRequest],
  ntick: true,
  response: [Circular *1],
  originalHost: 'www.vivintsky.com',
  originalHostHeaderName: 'host',
  responseContent: [Circular *1],
  _destdata: true,
  _ended: true,
  _callbackCalled: true,
  [Symbol(shapeMode)]: false,
  [Symbol(kCapture)]: false
},
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: '<html>\r\n' +
  '<head><title>502 Bad Gateway</title></head>\r\n' +
  '<body>\r\n' +
  '<center><h1>502 Bad Gateway</h1></center>\r\n' +
  '<hr><center>cloudflare</center>\r\n' +
  '</body>\r\n' +
  '</html>\r\n',
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: {
  server: 'cloudflare',
  date: 'Thu, 29 Aug 2024 17:25:08 GMT',
  'content-type': 'text/html',
  'content-length': '155',
  connection: 'keep-alive',
  'cf-ray': '8bae3d14fd53e25f-ORD'
},
[Symbol(kHeadersCount)]: 12,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0

} }

jgrimard commented 2 months ago

@bony618, you should change your Vivint password ASAP. The Cookie: 's=33025..........................' you posted gives anyone online full access to your Vivint account, your home address, and full control over your system.

bony618 commented 2 months ago

@bony618, you should change your Vivint password ASAP. The Cookie: 's=33025..........................' you posted gives anyone online full access to your Vivint account, your home address, and full control over your system.

thanks didn't realize that

bony618 commented 2 months ago

this morning I got a different error:

[9/3/2024, 4:04:38 AM] [@balansse/homebridge-vivint] Error getting system info: RequestError: AggregateError at new RequestError (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/errors.js:14:15) at Request.plumbing.callback (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/plumbing.js:87:29) at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/plumbing.js:46:31) at self.callback (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:185:22) at Request.emit (node:events:519:28) at Request.onRequestError (/usr/local/lib/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:877:8) at ClientRequest.emit (node:events:519:28) at TLSSocket.socketErrorListener (node:_http_client:500:9) at TLSSocket.emit (node:events:519:28) at emitErrorNT (node:internal/streams/destroy:169:8) { cause: AggregateError: at internalConnectMultiple (node:net:1118:18) at afterConnectMultiple (node:net:1685:7) { code: 'ETIMEDOUT', [errors]: [ [Error], [Error] ] }, error: AggregateError: at internalConnectMultiple (node:net:1118:18) at afterConnectMultiple (node:net:1685:7) { code: 'ETIMEDOUT', [errors]: [ [Error], [Error] ] }, options: { url: 'https://www.vivintsky.com/api/systems/6818692529018764', headers: { Cookie: 's=ff53***', 'Cache-Control': 'no-store' }, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined }

any help with these issues would be greatly appreciated

jgrimard commented 2 months ago

Not sure what is going on. I can't get mine to give either of those errors. The first one, 502 Bad Gateway, is coming from Cloudflare. That means Cloudflare can't connect to Vivint's server. Nothing you can do about that one. That is on Vivint's side. The second one is some sort of timeout error. But it is throwing multiple errors in a single AggregateError, so it is hard to tell. The plugin error handling code would have to be updated to handle Aggregate Errors, loop through them and print out the individual errors within.

bony618 commented 2 months ago

Not sure what is going on. I can't get mine to give either of those errors.

The first one, 502 Bad Gateway, is coming from Cloudflare. That means Cloudflare can't connect to Vivint's server. Nothing you can do about that one. That is on Vivint's side.

The second one is some sort of timeout error. But it is throwing multiple errors in a single AggregateError, so it is hard to tell. The plugin error handling code would have to be updated to handle Aggregate Errors, loop through them and print out the individual errors within.

i appreciate the response. not really sure what you mean in the aggregate part. (i'm a self taught fairly tech savvy boomer 😏 but some things go over my head.) i've just updated the plugin to the latest version. fingers crossed it's of some help.

jgrimard commented 2 months ago

AggregateError is a type of error where multiple error are thrown at once. It is an array of errors. The plugin code isn't handling it properly. Instead of actually printing out the error type and text it is printing [errors]: [ [Error], [Error] ] which is not very helpful.