Search code examples
mysqldockernode-red

Connecting Node Red and MySQL docker containers


I have two seperate docker containers, one running Node Red and one running MySQL. I create a node in the node red container using the contrib-mssql-plus-box plugin for node red. I've got a table on the MySQL container with some data in it called TimeData.

I then link the Node Red node to the container IP address as on the default bridge network in docker, with relevant login details.

In the MSSQL node, I have the following code:

SELECT TOP 1 * FROM TimeData;

I try to write this to a normal debug node (see layout below). But, when I try this, my node red container crashes with the following error:

18 Nov 13:56:28 - [red] Uncaught Exception:
18 Nov 13:56:28 - RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to write outside buffer bounds
    at boundsError (internal/buffer.js:47:11)
    at Buffer.readUInt8 (internal/buffer.js:213:5)
    at Packet.isLast (/data/node_modules/tedious/lib/packet.js:112:29)
    at ReadablePacketStream.<anonymous> (/data/node_modules/tedious/lib/message-io.js:91:18)
    at ReadablePacketStream.emit (events.js:198:13)
    at addChunk (/data/node_modules/readable-stream/lib/_stream_readable.js:291:12)
    at readableAddChunk (/data/node_modules/readable-stream/lib/_stream_readable.js:278:11)
    at ReadablePacketStream.Readable.push (/data/node_modules/readable-stream/lib/_stream_readable.js:245:10)
    at ReadablePacketStream.Transform.push (/data/node_modules/readable-stream/lib/_stream_transform.js:148:32)
    at ReadablePacketStream._transform (/data/node_modules/tedious/lib/message-io.js:57:16)

I'm not sure why I'm getting an outside buffer bounds error here? Is it my MySQL query or my container setup that is causing this?

enter image description here


Solution

  • You appear to be using the wrong node, MySQL != MSSQL.

    You are using the MS SQL node (For the Microsoft Database) to talk to MySQL. This just won't work.

    You need to install a MySQL node e.g. https://flows.nodered.org/node/node-red-node-mysql