Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPROTO protocol error after updating nodejs #76

Closed
NonjSAme opened this issue Aug 19, 2019 · 5 comments
Closed

EPROTO protocol error after updating nodejs #76

NonjSAme opened this issue Aug 19, 2019 · 5 comments

Comments

@NonjSAme
Copy link

[Opening this as a new issue as I discovered I had commented it under another issue not really related... Hope that is okay!]

I had to update my Homebridge server on a RPi to Debian Buster.
And with that came the need to update:

  • Node.js to v12.8.0
  • npm to v6.10.3

Now, homebridge had to be updated also. so after completely uninstalled (as far as i can see):

  • homebridge-telldus
  • hpmebridge

...and finally all over again a complete new installation of

I thought it then was ready to rock. But unfortunately, even after re-doing the homebridge/homebride-telldus uninstall-install procedure twice, i was still stuck with the same problem:
`

pi@SmartHomeServer:~ $ homebridge
[2019-8-16 5:44:33] Loaded config.json with 0 accessories and 1 platforms.
[2019-8-16 5:44:33] ---
[2019-8-16 5:44:33] Loaded plugin: homebridge-telldus
[2019-8-16 5:44:33] Registering platform 'homebridge-telldus.Telldus'
[2019-8-16 5:44:33] ---
[2019-8-16 5:44:33] Loading 1 platforms...
[2019-8-16 5:44:33] [Telldus Liv!e] Initializing Telldus platform...
[2019-8-16 5:44:33] [Telldus Liv!e] isLocal: false
[2019-8-16 5:44:33] [Telldus Liv!e] Loading accessories...
[2019-8-16 5:44:33] Loading 0 accessories...
[2019-8-16 5:44:33] [Telldus Liv!e] request to https://api.telldus.com/json/sensors/list failed, reason: write EPROTO 1995573712:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1922:

(node:1904) UnhandledPromiseRejectionWarning: FetchError: request to https://api.telldus.com/json/sensors/list failed, reason: write EPROTO 1995573712: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:203:13)
    at TLSSocket.socketErrorListener (_http_client.js:399:9)
    at TLSSocket.emit (events.js:203:13)
    at errorOrDestroy (internal/streams/destroy.js:107:12)
    at onwriteError (_stream_writable.js:439:5)
    at onwrite (_stream_writable.js:460:5)
    at internal/streams/destroy.js:49:7
    at TLSSocket.Socket._destroy (net.js:595:3)
    at TLSSocket.destroy (internal/streams/destroy.js:37:8)
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:84:12)
(node:1904) 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:1904) [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.

`

Somewhere on the internet (cant find it again unfortunately) i read that the EPROTO 'unsupported protocol' error could be caused by that - while the minimal supported TLS version in previos versions of Node.js was TLSv1.0 - since v11.4.0, it is raised to TLSv1.2.
And if there is a certificate being used that is signed with TLSv1.0 this could be the root of the cause. Okay... so doing some more tests down that road, I tried to figure out how to start homebridge with the node flag --tls-min-v1.0 forcing it to accept TLSv1.0 anyway.

Now, node homebirdge seems to be launched from the homebridge shell script at /usr/local/lib/node_modules/homebridge/bin. But adding flags to env in a shebang under Linux seems not as easy. At least not under Debian.

Fortunately, I also stumbled across this site http://sambal.org/2014/02/passing-options-node-shebang-line/

So, by hard coding /usr/local/lib/node_modules/homebridge/bin/homebridge to the following, it actually seems to work!!!!

`

#!/bin/sh
":" //# comment; exec /usr/bin/env node --tls-min-v1.0 "$0" "$@"

console.log('javascript');

//
// This executable sets up the environment and runs the HomeBridge CLI.
//

'use strict';

process.title = 'homebridge';

// Find the HomeBridge lib
var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');

// Run HomeBridge
require(lib + '/cli')();

`

Of course, this was a dirty quick fix, not suitable for updates, but someone out there that are a true programmer might be able to look into the TLS-version problem? What part of homebridge-telldus needs to be updated to use protocol TLSv1.2 to be able to again access Telldus Live under under Node.js v11.4.0 and above?

@mifi
Copy link
Collaborator

mifi commented Oct 13, 2019

It seems telldus api only supports old and insecure TLSv1, and node v12 requires this. i have now fixed that in the code

mifi added a commit that referenced this issue Oct 13, 2019
@mifi
Copy link
Collaborator

mifi commented Oct 13, 2019

should be fixed in 1.0.6

@ingvaldlorentzen
Copy link
Contributor

I'm getting this:
[Telldus Liv!e] Protocol "http:" not supported. Expected "https:" (node:91106) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:" error after upgrading node.

I'm using local configuration. Think it might be related?

mifi added a commit to mifi/telldus-api that referenced this issue Oct 21, 2019
@mifi
Copy link
Collaborator

mifi commented Oct 21, 2019

Yes! I messed up local api when fixing the https issue. have now fixed in newest version.

@ingvaldlorentzen
Copy link
Contributor

Awesome! Thanks!

Will test later today, I'll report back if there are any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants