SSL Connection to MySQL Azure failing in Node.js application

Viewed 1994

Following all of the documentation Microsoft provides for their new Azure MySQL product, I keep getting the same error

Error: 140736265921472:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794

I have tried this on a Linux docker container in case that I had an issue on macOS.

Example code, I have tried this isolated from my app to be sure:

var mysql = require('mysql2');

var conn = mysql.createConnection({
  host: "mydbname.mysql.database.azure.com",
  user: "user@mydbname",
  password: 'password',
  database: 'dbname',
  port: 3306,
  ssl: {
    ca: fs.readFileSync('./BaltimoreCyberTrustRoot.crt'),
  }
});

Documentation I followed:

https://docs.microsoft.com/en-us/azure/mysql/howto-configure-ssl https://docs.microsoft.com/en-us/azure/mysql/howto-connection-string

I have tried both mysql and mysql2 node drivers without success. Anyone solved this?

1 Answers
Related