diff --git a/lib/connection.js b/lib/connection.js index e2720be078..0f4df0e23c 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -333,14 +333,18 @@ class Connection extends EventEmitter { // eslint-disable-next-line no-console console.log('Upgrading connection to TLS'); } - const secureContext = Tls.createSecureContext({ - ca: this.config.ssl.ca, - cert: this.config.ssl.cert, - ciphers: this.config.ssl.ciphers, - key: this.config.ssl.key, - passphrase: this.config.ssl.passphrase, - minVersion: this.config.ssl.minVersion - }); + let secureContext + try { + secureContext = Tls.createSecureContext({ + ca: this.config.ssl.ca, + cert: this.config.ssl.cert, + ciphers: this.config.ssl.ciphers, + key: this.config.ssl.key, + passphrase: this.config.ssl.passphrase, + minVersion: this.config.ssl.minVersion + }) + } catch (error) { + } const rejectUnauthorized = this.config.ssl.rejectUnauthorized; let secureEstablished = false; const secureSocket = new Tls.TLSSocket(this.stream, {