0

I'm trying to use the web-push node.js library to send a push-notification to a chrome browser.

after firing the

webpush.sendNotification(pushSubscription,payload)

method i get this response -

{ Error: unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1060:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:584:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }

i'm guessing it's a SSL issue? How can i test this library over localhost?

Thanks

James Door
  • 13
  • 4

1 Answers1

0

I got it working by creating the nodejs server with https and the correct keys.

Not sure if this is the correct implementation but it got it up and running for us.

const https = require('https');
const fs = require('fs');

const options = {
  pfx: fs.readFileSync('server.pfx')
};

https.createServer(options, (req, res) => {
    //Do push things
}).listen(443);
James Door
  • 13
  • 4
  • This is pretty weird if I'm honest. I don't see how this would help. Could you provide more sample code and open an issue on the project: https://github.com/web-push-libs/web-push/issues/new – Matt Gaunt Jan 19 '17 at 16:57