louis49 / androidtv-remote

MIT License
68 stars 23 forks source link

Unhandled 'error' event in TLSSocket #31

Closed raintonr closed 1 year ago

raintonr commented 1 year ago

This has been working well for me for quite some time, but today started seeing this error. This happens with the example code from README.md. This all worked perfectly previously but for some reason now fails.

Running on my Lenovo laptop (identified in some of this logging), after successful pairing and reconnect, the ready event is fired then this error appears on console output:

tv Receive : {"remoteError":{"value":true,"message":{"remoteConfigure":{"code1":622,"deviceInfo":{"model":"4286CTR","vendor":"LENOVO","unknown1":1,"unknown2":"1","packageName":"androitv-remote","appVersion":"1.0.0"}}}}}
node:events:504
    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
  error: RemoteError {
    value: true,
    message: RemoteMessage { remoteConfigure: [RemoteConfigure] }
  }
})
    at new NodeError (node:internal/errors:387:5)
    at RemoteManager.emit (node:events:502:17)
    at TLSSocket.<anonymous> (/home/raintonr/node_modules/androidtv-remote/dist/remote/RemoteManager.js:107:21)
    at TLSSocket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  code: 'ERR_UNHANDLED_ERROR',
  context: {
    error: RemoteError {
      value: true,
      message: RemoteMessage {
        remoteConfigure: RemoteConfigure {
          code1: 622,
          deviceInfo: RemoteDeviceInfo {
            model: '4286CTR',
            vendor: 'LENOVO',
            unknown1: 1,
            unknown2: '1',
            packageName: 'androitv-remote',
            appVersion: '1.0.0'
          }
        }
      }
    }
  }
}
raintonr commented 1 year ago

Remote in the Google Home app also stopped working, which indicates there was probably a problem with the TV. Reboot of the TV fixed this issue. Doh! :clown_face: