External MYSQL SSL Broken Since v2.13.2


#1

Hello,

I am getting the following error when trying to connect to AWS RDS (MySQL) via SSL when starting ghost since the v2.13.2 update.

Is anyone else using Amazon RDS MYSQL with SSL? Or any external MYSQL with SSL on the latest versions?

/var/www/ghost$ ghost run
The ghost run command is used by the configured Ghost process manager and for debugging. If you’re not running this to debug something, you should run ghost start instead.

  • sudo node current/index.js
    events.js:174
    throw er; // Unhandled ‘error’ event
    ^

Error: shutdown ENOTCONN
at TLSSocket.Socket._final (net.js:364:25)
at callFinal (_stream_writable.js:612:10)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted ‘error’ event at:
at Connection._handleProtocolError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/Connection.js:425:8)
at Protocol.emit (events.js:189:13)
at Protocol._delegateError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/protocol/Protocol.js:390:10)
at Protocol.handleNetworkError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/protocol/Protocol.js:363:10)
at Connection._handleNetworkError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/Connection.js:420:18)
at TLSSocket. (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/Connection.js:305:20)
at TLSSocket.emit (events.js:189:13)
at TLSSocket._tlsError (_tls_wrap.js:612:8)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)

When I start ghost without SSL to the DB then everything starts fine.

I enabled debug on the database connection and here is where it is failing.

<-- (16739) RowDataPacket
RowDataPacket {
  id: 36,
  name: '1-add-type-column-to-integrations.js',
  version: '2.15',
  currentVersion: '2.15' }

<-- (16739) RowDataPacket
RowDataPacket {
  id: 37,
  name: '2-insert-zapier-integration.js',
  version: '2.15',
  currentVersion: '2.15' }

<-- (16739) EofPacket
EofPacket {
  fieldCount: 254,
  warningCount: 0,
  serverStatus: 34,
  protocol41: true }

--> (16748) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16741) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16746) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16743) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16742) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16747) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16745) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16744) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16740) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16739) ComQuitPacket
ComQuitPacket { command: 1 }

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: shutdown ENOTCONN
    at TLSSocket.Socket._final (net.js:364:25)
    at callFinal (_stream_writable.js:612:10)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Connection._handleProtocolError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/Connection.js:425:8)
    at Protocol.emit (events.js:189:13)
    at Protocol._delegateError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/protocol/Protocol.js:390:10)
    at Protocol.handleNetworkError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/protocol/Protocol.js:363:10)
    at Connection._handleNetworkError (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/Connection.js:420:18)
    at TLSSocket.<anonymous> (/var/www/ghost/versions/2.15.0/node_modules/mysql/lib/Connection.js:305:20)
    at TLSSocket.emit (events.js:189:13)
    at TLSSocket._tlsError (_tls_wrap.js:612:8)
    at TLSSocket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

When I remove the SSL option, ghost fully loads. I suspect that this is where the error is since it’s the next command in the debug.

<-- (16769) RowDataPacket
RowDataPacket {
  id: 36,
  name: '1-add-type-column-to-integrations.js',
  version: '2.15',
  currentVersion: '2.15' }

<-- (16769) RowDataPacket
RowDataPacket {
  id: 37,
  name: '2-insert-zapier-integration.js',
  version: '2.15',
  currentVersion: '2.15' }

<-- (16769) EofPacket
EofPacket {
  fieldCount: 254,
  warningCount: 0,
  serverStatus: 34,
  protocol41: true }

--> (16760) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16764) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16765) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16768) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16767) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16766) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16763) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16762) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16761) ComQuitPacket
ComQuitPacket { command: 1 }

--> (16769) ComQuitPacket
ComQuitPacket { command: 1 }

<-- HandshakeInitializationPacket
HandshakeInitializationPacket {
  protocolVersion: 10,
  serverVersion: '5.7.23-log',
  threadId: 16770,
  scrambleBuff1: <Buffer 7d 45 79 44 01 0a 36 2b>,
  filler1: <Buffer 00>,
  serverCapabilities1: 65535,
  serverLanguage: 8,
  serverStatus: 2,
  serverCapabilities2: 49663,
  scrambleLength: 21,
  filler2: <Buffer 00 00 00 00 00 00 00 00 00 00>,
  scrambleBuff2: <Buffer 75 6b 67 49 78 70 19 6f 29 61 4d 4e>,
  filler3: <Buffer 00>,
  pluginData: 'mysql_native_password',
  protocol41: true }

Thanks,
Dan


#2

Been having issues with both Heroku (Amazon RDS database) and on Google (Google Cloud SQL database). Digging through it at the moment…when I use Knex or mysqljs directly I have no problems, so there is definitely something fishy going on.


#3

https://github.com/nodejs/node/issues/26315 turned out to be my issue. Downgraded to NodeJS 10.15.0, all issues disappeared. :clown_face:


closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.