"Deploy failed: No response from server" when inserting into MySQL

I am getting "Deploy failed: No response from server" when I am trying to Insert the data coming from real-time sensors in JSON format.
All the other queries except the Insert query is running fine.

Below is the Insert query I am using inside my template node:

INSERT INTO aress_support_sensor (mac_id, timestamp, temperature, humidity, air_quality, air_quality_value, loudness, sensor_buzzed)
VALUES ("{{{payload.0}}}","{{{payload.1}}}","{{{payload.2}}}","{{{payload.3}}}","{{{payload.4}}}","{{{payload.5}}}","{{{payload.6}}}","{{{payload.7}}}");

This query ran once and the deployment was successful. But immediately after 10 15 minutes, when I updated the flow and deployed it, the deployment was failing with this error: " [Deploy failed: no response from server]"

I am unable to figure out the issue as I have tried all the possible ways to use the Insert query.

I think it most unlikely that the query is directly causing the problem. Stop and restart node-red and then get to the point where it shows the error. Then copy/paste the node red log here. Dependant on how you installed node-red you may be able to do this by

node-red-stop
node-red-start

Thanks Colin for your quick response.

I tried stopping and starting the node-red, but still I was facing the same issue.
Even I uninstalled the node-red on the server and re-installed it, but no success.

As the deployment is failing, no logs are being generated for this error.

This is the error message I received:

BadRequestError: request aborted
at IncomingMessage.onAborted (/usr/lib/node_modules/node-red/node_modules/raw-body/index.js:231:10)
at IncomingMessage.emit (events.js:198:13)
at abortIncoming (_http_server.js:450:9)
at socketOnClose (_http_server.js:443:3)
at Socket.emit (events.js:203:15)
at TCP._handle.close (net.js:607:12)

Please post the full log from node red start as I requested

Please find the below log after restarting the node-red:

6 Dec 07:55:05 - [info] Node-RED version: v1.0.3
6 Dec 07:55:05 - [info] Node.js version: v10.17.0
6 Dec 07:55:05 - [info] Linux 4.4.0-1099-aws x64 LE
6 Dec 07:55:05 - [info] Loading palette nodes
6 Dec 07:55:05 - [info] Dashboard version 2.19.1 started at /ui
6 Dec 07:55:05 - [info] Settings file : /home/ubuntu/.node-red/settings.js
6 Dec 07:55:05 - [info] Context store : 'default' [module=memory]
6 Dec 07:55:05 - [info] User directory : /home/ubuntu/.node-red
6 Dec 07:55:05 - [warn] Projects disabled : editorTheme.projects.enabled=false
6 Dec 07:55:05 - [info] Flows file : /home/ubuntu/.node-red/flows_ip-172-31-90-206.json
6 Dec 07:55:05 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in

your settings file. Node-RED will then re-encrypt your credentials

file using your chosen key the next time you deploy a change.


6 Dec 07:55:05 - [info] Starting flows
6 Dec 07:55:06 - [info] Started flows
6 Dec 07:55:06 - [info] Server now running at http://127.0.0.1:1880/
6 Dec 07:55:06 - [info] [mqtt-broker:AressSupportTH] Connected to broker: AressSupportTH@mqtts://**********.iot.us-east-1.amazonaws.com:8883

I don't see the error in the log. Restart node-red, make a trivial change to the flow and deploy it. Then post the log again.

In continuation with above :

Log generated after making a minor change, with deployment success:
6 Dec 08:14:38 - [info] Stopped flows
6 Dec 08:14:38 - [info] Starting flows
6 Dec 08:14:38 - [info] Started flows
6 Dec 08:14:38 - [info] [mqtt-broker:AressSupportTH] Connected to broker: AressSupportTH@mqtts://**********.iot.us-east-1.amazonaws.com:8883

Log generated after adding a template node and a simple Insert query into it [Query: INSERT INTO aress_test (message)
VALUES ("{{{payload.message}}}");] -->
BadRequestError: request aborted
at IncomingMessage.onAborted (/usr/lib/node_modules/node-red/node_modules/raw-body/index.js:231:10)
at IncomingMessage.emit (events.js:198:13)
at abortIncoming (_http_server.js:450:9)
at socketOnClose (_http_server.js:443:3)
at Socket.emit (events.js:203:15)
at TCP._handle.close (net.js:607:12)

Attached is the templatenode snippet and the deployment error snippet.

That is not what you said before. You said that you added the query and it ran once, then some time later you could not deploy. Now you appear to be saying that you cannot deploy this particular node.
Try again, but this time remove the wires connecting the output of the node and see if you can deploy that. If so then add the wire to the debug node and deploy it again. See what you see in the debug node. Set the debug node to show the full message.
I suspect that the problem is not that it cannot deploy, but that the node you are feeding the message into is failing. What node type is it (node-red-contrib-something probably)?

Three questions

  1. which MySQL node did you install (node-red-?????????)
  2. if you disconnect the template do a simple select work?
  3. what happens if you hard code the insert, with data, into the node itself?

Okay, let me elaborate the complete issue again:

Everything works fine when there is NO insert query inside a Template Node (node-red Module) or the Function Node (with or without the wires connected)

But the moment I perform the Insert operation by adding an Insert query into a Template Node or a Function Node with or without connecting the wires and try to deploy it, the deployment fails with "No response" message.

In that case the debug node also could not produce the error message as the deployment is failing.

Yesterday the same thing was deployed successfully (Even this success was after trying multiple combinations of inserting the query for more than 100 times). But after the successful execution, when I made a trivial change in other node (e.g. the guage node - which is nothing to do with the template node) the deployment failed again.

Now, in current scenario, the moment I delete the template node, the deployment is successful. Or the moment I remove the Insert query, and put some other stuff inside it, the deployment is successful.

@zenofmud -

Answers to your questions:

  1. which MySQL node did you install (node-red-?????????)
    Ans: node-red-node-mysql

  2. if you disconnect the template do a simple select work?
    Ans: Everything works fine.

  3. what happens if you hard code the insert, with data, into the node itself?
    Ans: Still the deployment fails. I tried every possible way to insert my data into MySQL database using the Template as well as Function node.

Does the user you are using to access the database have insert authority?

Yes. It has all the privileges. Delete and select queries are also working fine.

Is the MySQL database on the same or a different machine?
I just ran a test and inserts work fone for me. in my case MySQL is on the same machine as NR.

If you insert ran nee and tehn stopped, have you looked in the logs of the database to see if naything funky is happening there?

The MySQL database is on the same machine. Even I did setup a new server and tried the same activity on that server, still there was this issue.

Just now I tried using "REPLACE INTO" instead of "INSERT INTO" in my query and it worked fine!!
However, this is not the motive of the task I am doing.

I checked the MySQL logs but no log has been recorded for this issue.

feel like sharing your db schema and flow so I can try to reproduce it?

Below is the DB schema:

+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| message | varchar(30) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+

Below is the flow that I am testing on:

[{"id":"2867501b.43456","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"560199de.cdcaf8","type":"mysql","z":"2867501b.43456","mydb":"2a44bcb3.ad6994","name":"","x":550,"y":180,"wires":[["6d7e9abd.a213b4"]]},{"id":"6d7e9abd.a213b4","type":"debug","z":"2867501b.43456","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":180,"wires":[]},{"id":"845ca325.9ebb2","type":"inject","z":"2867501b.43456","name":"","topic":"","payload":"{\"message\":\"Foo\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":180,"wires":[["7303633e.cac12c"]]},{"id":"7303633e.cac12c","type":"function","z":"2867501b.43456","name":"","func":"msg.topic = \"INSERT INTO aress_test (message) VALUES (?);\"\nmsg.payload=[msg.payload.message];\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":180,"wires":[["560199de.cdcaf8"]]},{"id":"2a44bcb3.ad6994","type":"MySQLdatabase","z":"","host":"localhost","port":"3306","db":"AressSensorData","tz":""}]

Please see this and edit your post accordingly so that we can import your flow

Also with that flow, when do you get the Deploy Failed message?