konradknitter / homebridge-philips-android-tv

Homebridge module for the Philips Android TV
Apache License 2.0
48 stars 6 forks source link

Unhandled SyntaxError #31

Closed itavero closed 3 years ago

itavero commented 3 years ago

Describe The Bug: I think my TV (Philips 55OLED805) got an update and today I noticed my Homebridge instance was unresponsive. This was caused by an unhandled error from this plugin.

Instead of crashing, I would expect the plugin to catch the error and log it instead. Maybe it should also log the actual response it received, so it can be used for further analysis.

Ofcourse, there's also something else wrong causing this error, but I'll try setting up the username/password up again and do some more analysis for that.

Logs:

4/15/2021, 8:27:18 PM] SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at PhilipsAndroidTvAccessory.<anonymous> (/homebridge/node_modules/homebridge-philips-android-tv/src/index.ts:507:37)
    at Request.self.callback (/homebridge/node_modules/homebridge-philips-android-tv/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (/homebridge/node_modules/homebridge-philips-android-tv/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (/homebridge/node_modules/homebridge-philips-android-tv/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
[4/15/2021, 8:27:18 PM] SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at PhilipsAndroidTvAccessory.<anonymous> (/homebridge/node_modules/homebridge-philips-android-tv/src/index.ts:471:37)
    at Request.self.callback (/homebridge/node_modules/homebridge-philips-android-tv/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (/homebridge/node_modules/homebridge-philips-android-tv/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (/homebridge/node_modules/homebridge-philips-android-tv/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
[4/15/2021, 8:27:18 PM] Got SIGTERM, shutting down Homebridge...

Environment:

itavero commented 3 years ago

This has also been reported in #29. In that issue it is mentioned that the problem got solved by repairing the TV. However, I still think a Homebridge plugin should not have unhandled errors (it's also one of the "rules" for having a plugin verified).

ring09 commented 3 years ago

I have the same problem right away, a new pairing did not provide a solution. Does anyone have any further ideas?

konradknitter commented 3 years ago

Hi, please check if issue had been solved in new version (0.9.0). All errors should be now properly catch.