pimatic / pimatic-mail

Mail notifications from pimatic
GNU General Public License v2.0
3 stars 3 forks source link

After upgrade to node.js V4.9.1 not working anymore (TypeError: tls.convertNPNProtocols is not a function) #11

Open HenriMatthijssen opened 6 years ago

HenriMatthijssen commented 6 years ago

16:29:40.020 [pimatic] error: An uncaught exception occurred: TypeError: tls.convertNPNProtocols is not a function
16:29:40.020 [pimatic] error:>    at Object.TLSSocket._init.ssl.onclienthello.ssl.oncertcb.exports.connect (_tls_wrap.js:1018:7)
16:29:40.020 [pimatic] error:>    at SMTPClient._upgradeConnection (/home/pi/pimatic-app/node_modules/pimatic-mail/node_modules/nodemailer/node_modules/simplesmtp/lib/client.js:250:23)
16:29:40.020 [pimatic] error:>    at SMTPClient._actionSTARTTLS (/home/pi/pimatic-app/node_modules/pimatic-mail/node_modules/nodemailer/node_modules/simplesmtp/lib/client.js:789:10)
16:29:40.020 [pimatic] error:>    at SMTPClient._onData (/home/pi/pimatic-app/node_modules/pimatic-mail/node_modules/nodemailer/node_modules/simplesmtp/lib/client.js:354:29)
16:29:40.020 [pimatic] error:>    at emitOne (events.js:77:13)
16:29:40.020 [pimatic] error:>    at Socket.emit (events.js:169:7)
16:29:40.020 [pimatic] error:>    at Socket.emit (/home/pi/pimatic-app/node_modules/pimatic/startup.coffee:63:24)
16:29:40.020 [pimatic] error:>    at readableAddChunk (_stream_readable.js:153:18)
16:29:40.020 [pimatic] error:>    at Socket.Readable.push (_stream_readable.js:111:10)
16:29:40.020 [pimatic] error:>    at TCP.onread (net.js:540:20)
16:29:40.020 [pimatic] error:> This is most probably a bug in pimatic or in a module, please report it!
mwittig commented 6 years ago

I assume this worked for you with a previous version of node.js v4.x, right?

It looks like there is an issue the tls lib of node.js 4.9 which might be related to the dependency updates. See also Changelog. My suggestion is to downgrade Node.js to Version 4.8.7.

I am setting this issue to won't fix as we're planning to migrate to node.js 8 soon.

HenriMatthijssen commented 6 years ago

Thank you for this quick reaction mwittig.

Indeed this worked for me with the previous version of node.js. I just tried to downgrade to Version 4.8.7 (when I type: "node -v" I get back V4.8.7) but still the same issue. However not sure if I performed the downgrade back correctly.

I think I will try to re-install Pimatic on my Raspberry Pi very soon using node.js V4.8.7 and check again. However not sure when I can do this. When done I will update this thread again.

edautz commented 6 years ago

I have a simular issue after a fresh Pimatic stretch install with node 4.6.2.

https://github.com/pimatic/pimatic/issues/1099

for the phone and pushover plug-in. I don’t use the mail plug-in.

Did a reinstall of Pimatic with node 4.4.5 but error stays. Seems to be related to the new stretch release.

HenriMatthijssen commented 6 years ago

Good point 'edautz'. I also upgraded Raspbian on my Raspberry Pi in parallel. This could explain why it does not work with older node 4.x anymore as well (I thought that it was perhaps related to an incorrect downgrade by me).

PS: I do not use the Pushover plugin anymore. Instead I use the pushover API directly. See also https://pushover.net/api

Example what you can put in a rule:

curl -s --form-string "token=xyz" --form-string user="abc" --form-string "priority=-1" --form-string "message=my message here" -F "attachment=@/home/pi/pimatic-app/node_modules/pimatic-mobile-frontend/public/photo_front.jpg" https://api.pushover.net/1/messages.json 2> /dev/null

edautz commented 6 years ago

I know the pushover api. Use it when I program a script in bash. Is there a special reason way you aren’t using the pushover plug-in?

I am testing the new raspbian stretch version on my staging machine, not on production because I suffer on this machine with rasbian jessie of frequent homeduino time-outs.

That kind of time-outs don’t I see anymore after the stretch update.

HenriMatthijssen commented 6 years ago

Reason is that there is no need to use the Pushover Plug-In when you can use the API via curl. I prefer to keep the number of Plugins to a minimum.