mysqlazureazure-database-mysql

SSL Connection to MySQL Azure failing in Node.js application


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://learn.microsoft.com/en-us/azure/mysql/howto-configure-ssl https://learn.microsoft.com/en-us/azure/mysql/howto-connection-string

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


Solution

  • Thanks for reporting the issue. The bug had been exposed in our internal testings and fixed. We will deploy the fix these several days, and we'll keep you posted. At the mean time, please use non-ssl mode to mitigate if you could. Thanks!

    -----Edit-----

    Hi, the fix has been deployed. Please try out! Thanks.