johnlemonse / homebridge-telldus

36 stars 22 forks source link

Unhandled promises #75

Closed mgor closed 5 years ago

mgor commented 5 years ago

Since upgrading to homebridge@0.4.49 the latest version of this plugin (1.0.5) stopped working:

maj 28 21:05:44 pc homebridge[13516]: [5/28/2019, 9:05:44 PM] [Telldus Live] Initializing Telldus platform...
maj 28 21:05:44 pc homebridge[13516]: [5/28/2019, 9:05:44 PM] [Telldus Live] isLocal: false
maj 28 21:05:44 pc homebridge[13516]: [5/28/2019, 9:05:44 PM] [Telldus Live] Loading accessories...
maj 28 21:05:45 pc homebridge[13516]: { sensor: [] }
maj 28 21:05:45 pc homebridge[13516]: [5/28/2019, 9:05:45 PM] [Telldus Live] body used already for: https://api.telldus.com/json/sensors/list
maj 28 21:05:45 pc homebridge[13516]: (node:13516) UnhandledPromiseRejectionWarning: Error: body used already for: https://api.telldus.com/json/sensors/list
maj 28 21:05:45 pc homebridge[13516]:     at Response.Body._decode (/home/user/.local/share/node_modules/lib/node_modules/homebridge-telldus/node_modules/node-fetch/lib/body.js:88:30)
maj 28 21:05:45 pc homebridge[13516]:     at Response.Body.json (/home/user/.local/share/node_modules/lib/node_modules/homebridge-telldus/node_modules/node-fetch/lib/body.js:44:14)
maj 28 21:05:45 pc homebridge[13516]:     at LiveApi.request (/home/user/.local/share/node_modules/lib/node_modules/homebridge-telldus/node_modules/telldus-api/index.js:231:21)
maj 28 21:05:45 pc homebridge[13516]:     at process._tickCallback (internal/process/next_tick.js:68:7)
maj 28 21:05:45 pc homebridge[13516]: (node:13516) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
maj 28 21:05:45 pc homebridge[13516]: (node:13516) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled
will terminate the Node.js process with a non-zero exit code.

Seems like it was a while since anything happened in this repository. If there's no active development, I'll submit a PR when I've had the time to investigate the problem further.

mifi commented 5 years ago

Hmm, maybe they changed something in the newest version of homebridge. Feel free to investigate and make a PR :)

larsamannen commented 5 years ago

Getting the following error:

[6/6/2019, 7:57:37 PM] [Telldus Live] request to https://api.telldus.com/json/sensors/list failed, reason: write EPROTO 4403303872:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1922:

(node:36476) UnhandledPromiseRejectionWarning: FetchError: request to https://api.telldus.com/json/sensors/list failed, reason: write EPROTO 4403303872:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1922:

    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/homebridge-telldus/node_modules/node-fetch/index.js:133:11)
    at ClientRequest.emit (events.js:196:13)
    at TLSSocket.socketErrorListener (_http_client.js:402:9)
    at TLSSocket.emit (events.js:196:13)
    at errorOrDestroy (internal/streams/destroy.js:107:12)
    at onwriteError (_stream_writable.js:438:5)
    at onwrite (_stream_writable.js:459:5)
    at internal/streams/destroy.js:49:7
    at TLSSocket.Socket._destroy (net.js:593:3)
    at TLSSocket.destroy (internal/streams/destroy.js:37:8)
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:84:12)
(node:36476) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:36476) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 
mifi commented 5 years ago

Does it work with older version of homebridge? which version broke it?

mgor commented 5 years ago

Hm, very strange. I re-arranged my global node_modules directory and re-installed homebridge and homebridge-telldus with npm and the problem disappeared.

mifi commented 5 years ago

So can close this now?

mifi commented 5 years ago

EPROTO is fixed now. Closing this. see #76