Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.4.3, 3.4.4
-
None
Description
SSL Connection Error with MariaDB Node.js Connector 3.4.3/3.4.4
Reference: https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/319
Problem:
When using MariaDB Node.js connector versions 3.4.3 or 3.4.4 with SSL enabled and a custom CA certificate, without specific checkServerIdentity, connections to MariaDB servers prior to version 11.4 or MySQL servers will fail with the following error:
TypeError: validationFunction is not a function |
at Authentication.handshakeResult (....../node_modules/mariadb/lib/cmd/handshake/authentication.js:105:35)
|
at Authentication.onPacketReceive (....../node_modules/mariadb/lib/cmd/handshake/authentication.js:42:17)
|
at PacketInputStream.receivePacketBasic (....../node_modules/mariadb/lib/io/packet-input-stream.js:85:9)
|
at PacketInputStream.onData (....../node_modules/mariadb/lib/io/packet-input-stream.js:135:20)
|
at TLSSocket.emit (node:events:520:28)
|
at addChunk (node:internal/streams/readable:559:12)
|
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
|
at Readable.push (node:internal/streams/readable:390:5)
|
at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)
|
Workaround
Add `checkServerIdentity: null` to your SSL configuration to bypass issue.
Before (causes error):
const dbConf = {
|
host: 'localhost', |
user: 'myUser', |
password: 'myPwd', |
ssl: {
|
ca: caFile
|
}
|
}
|
must be :
const dbConf = {
|
host: 'localhost', |
user: 'myUser', |
password: 'myPwd', |
ssl: {
|
ca: caFile,
|
checkServerIdentity: null |
}
|
}
|
(checkServerIdentity will still be executed)