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

TypeError: "options" must be a string or an object, got number instead. #26

Closed pratikd650 closed 7 years ago

pratikd650 commented 7 years ago

I am getting this error with the provided sample problem

at getOptions (fs.js:50:11) at fs.readFileSync (fs.js:465:13) at Array.map (native) at exports.SslClient.connect (/home/pi/motor/node_modules/blynk-library/blynk-node.js:170:42) at doConnect (/home/pi/motor/node_modules/blynk-library/blynk.js:546:15) at Blynk.connect (/home/pi/motor/node_modules/blynk-library/blynk.js:559:5) at new Blynk (/home/pi/motor/node_modules/blynk-library/blynk.js:385:10) at Object. (/home/pi/motor/blynk-motor.js:9:13) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10)

I looked at the code carefully and it is at this line

if (self.ca) { opts.ca = self.ca.map(fs.readFileSync); }

fs.readFileSync takes options as second parameter, so it can't be used with map.

vshymanskyy commented 7 years ago

fixed

DanielChisica commented 7 years ago

Can anyone help me with this problem? I don't know how to fix it