diff --git a/index.js b/index.js index abab3fd..24026c2 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,7 @@ module.exports.create = function (opts) { ); httpType = 'http'; - return { server: server, listen: function () { return new Promise(function (resolve, reject) { + return { server: server, listen: function () { return new PromiseA(function (resolve, reject) { args[0] = p; args.push(function () { if (!greenlock.servername) { @@ -135,11 +135,16 @@ module.exports.create = function (opts) { // ignore the case that check doesn't have all the right args here // to get the same certs that it just got (eventually the right ones will come in) if (!certs) { return; } - console.info("Using '%s' as default certificate", domain); - server.setSecureContext({ - key: Buffer.from(certs.privkey, 'ascii') - , cert: Buffer.from(certs.cert + '\r\n' + certs.chain, 'ascii') - }); + try { + server.setSecureContext({ + key: Buffer.from(certs.privkey, 'ascii') + , cert: Buffer.from(certs.cert + '\r\n' + certs.chain, 'ascii') + }); + console.info("Using '%s' as default certificate", domain); + } catch(e) { + console.warn("node " + process.version + " is out of date and some (nice, but non-critical) features are unavaliable."); + console.warn("Please update to node v10.13+ if possible."); + } server._hasDefaultSecureContext = true; }).catch(function (/*e*/) { // this may be that the test.example.com was requested, but it's listed @@ -210,7 +215,12 @@ module.exports.create = function (opts) { server.then = obj1.listen().then(function (tlsOptions) { if (tlsOptions) { - server.setSecureContext(tlsOptions); + try { + server.setSecureContext(tlsOptions); + } catch(e) { + console.warn("node " + process.version + " is out of date and some (nice, but non-critical) features are unavaliable."); + console.warn("Please update to node v10.13+ if possible."); + } server._hasDefaultSecureContext = true; } return obj2.listen().then(function () { diff --git a/package.json b/package.json index c198e52..2e378fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "greenlock-express", - "version": "2.6.4", + "version": "2.6.5", "description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.", "main": "index.js", "homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js",