vshymanskyy / blynk-library-js

Blynk library for JS. Works with Browsers, Node.js, Espruino.
https://blynk.io/
MIT License
215 stars 67 forks source link

Connecting to local blynk server fails with DEPTH_ZERO_SELF_SIGNED_CERT #12

Closed fgenoese closed 8 years ago

fgenoese commented 8 years ago

I am running a local blynk server (0.11.4) on a Raspberry Pi with a self-signed SSL certificate, as instructed in the wiki.

When trying to connect through blynk-library-js (0.0.23), I get the following error:

OnOff mode
Connecting to SSL: 192.168.1.55 8443
Error DEPTH_ZERO_SELF_SIGNED_CERT

The exact code I am using to connect is:

var BlynkLib = require('/usr/local/lib/node_modules/blynk-library');
var options = {addr:"192.168.1.55",port:8443}
var AUTH = 'XXXXX';
var blynk = new BlynkLib.Blynk(AUTH, options);

Both the server key and certificate are recognised in the start-up process of the server but I am not sure where to get/put the client certificate? The server log prints this:

16:25:14.272 INFO  - Plain tcp/ip hardware server port 8442.
16:25:31.156 INFO  - SSL hardware port 8441.
16:25:31.289 INFO  - Enabling SSL for application.
16:25:31.293 WARN  - Found server certificates but no client certificate for '/home/pi/blynk-server' path. Using one way ssl.
16:25:31.651 INFO  - Application server port 8443.
16:25:31.725 INFO  - Administration server port 8777.

Thanks

fgenoese commented 8 years ago

OK, solved. One simply needs to place a copy of the self-signed certificate into: _/usr/local/lib/nodemodules/blynk-library/certs/

The follow-up error (leaving everything else the same) is:

OnOff mode
Connecting to SSL: 192.168.1.55 8443
Error undefined

There is nothing in the server log (blynk.log) - any hints?

vshymanskyy commented 8 years ago

Hi. You specified var options = {addr:"192.168.1.55",port:8443}. Please note that hardware connection port is 8441 by default.

fgenoese commented 8 years ago

Thanks for the reply. I changed as suggested but the error persists even at port 8441:

OnOff mode
Connecting to SSL: 192.168.1.55 8441
Error undefined
Connecting to SSL: 192.168.1.55 8441
Error undefined
karanmakharia commented 8 years ago

I am also getting the same eror Undefined. Somebody please suggest any solution. @vshymanskyy @fgenoese