Connecting to MySQL from NodeJS (Express App) throws error - mysql

edit:
Solved my problem. After removing the line
connection.connect(function(err) {
if (err) throw err;
});
I got the raw MySQL error message saying that the login credentials for MySQL are wrong. I already checked my passwort, but din't noticed the wrong username. Very sorry fr my dumb question.
I have a NodeJS / Express app. It was already working fine but know I dont'get a connection any more to MySQL (MariaDB). Always I try to start the app (with pm2) the start failed, because a exception is thrown.
I have already checked if MySQL is running and I also restarted MySQL and NodeJS app and pdated node-mysql. This is my code for connecting to mysql:
//local mysql db connection
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'xxx',
database : 'lizenzverwaltung'
});
connection.connect(function(err) {
if (err) throw err;
});
module.exports = connection;
The error message on startup is:
0|www | at Socket.<anonymous> (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/Connection.js:525:10)
0|www | at Socket.emit (events.js:182:13)
0|www | at Socket.EventEmitter.emit (domain.js:442:20)
0|www | --------------------
0|www | at Protocol._enqueue (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/protocol/Protocol.js:144:48)
0|www | at Protocol.handshake (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/protocol/Protocol.js:51:23)
0|www | at Connection.connect (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/Connection.js:119:18)
0|www | at Object.<anonymous> (/var/www/html/lizenzverwaltung/models/db.js:11:12)
0|www | at Module._compile (internal/modules/cjs/loader.js:702:30)
0|www | at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
0|www | at Module.load (internal/modules/cjs/loader.js:612:32)
0|www | at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
0|www | at Function.Module._load (internal/modules/cjs/loader.js:543:3)
0|www | at Module.require (internal/modules/cjs/loader.js:650:17)
If I comment out the line
if (err) throw err;
I can start the NodeJS app, but get the following error, as soon, as I try to run a SQL query:
0|www | at Protocol._validateEnqueue (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/protocol/Protocol.js:212:16)
0|www | at Protocol._enqueue (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/protocol/Protocol.js:138:13)
0|www | at Connection.query (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/Connection.js:201:25)
0|www | at Function.verifyLicense [as verify] (/var/www/html/lizenzverwaltung/models/licenseModel.js:29:9)
0|www | at Function.LicenseController.veryLicense (/var/www/html/lizenzverwaltung/controllers/licenseController.js:51:18)
0|www | at /var/www/html/lizenzverwaltung/routes/license.js:33:21
0|www | at Layer.handle [as handle_request] (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/layer.js:95:5)
0|www | at next (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/route.js:137:13)
0|www | at Route.dispatch (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/route.js:112:3)
0|www | at Layer.handle [as handle_request] (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/layer.js:95:5) code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR', fatal: false }
0|www | error { Error: Cannot enqueue Query after fatal error.
0|www | at Protocol._validateEnqueue (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/protocol/Protocol.js:212:16)
0|www | at Protocol._enqueue (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/protocol/Protocol.js:138:13)
0|www | at Connection.query (/var/www/html/lizenzverwaltung/node_modules/mysql/lib/Connection.js:201:25)
0|www | at Function.verifyLicense [as verify] (/var/www/html/lizenzverwaltung/models/licenseModel.js:29:9)
0|www | at Function.LicenseController.veryLicense (/var/www/html/lizenzverwaltung/controllers/licenseController.js:51:18)
0|www | at /var/www/html/lizenzverwaltung/routes/license.js:33:21
0|www | at Layer.handle [as handle_request] (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/layer.js:95:5)
0|www | at next (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/route.js:137:13)
0|www | at Route.dispatch (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/route.js:112:3)
0|www | at Layer.handle [as handle_request] (/var/www/html/lizenzverwaltung/node_modules/express/lib/router/layer.js:95:5) code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR', fatal: false } result null
0|www | POST /v1/license/verify/ 200 19.128 ms - 16
I already searched but didn't found a solution. Do you have any tips? My MySQL server should working fine, PHPMyAdmin and my Wordpress sites are running fine.
Thanks,
Klaus

Solved my problem. After removing the line
connection.connect(function(err) {
if (err) throw err;
});
I got the raw MySQL error message saying that the login credentials for MySQL are wrong. I already checked my passwort, but din't noticed the wrong username. Very sorry for my dumb question.

Related

I cannot connect to mysql database using node.js

I am total beginner to database.
I am using localhost(127.0.0.1) with port 9090.
I successfully created mysql database, ran/used it in windows 10 command prompt and MySQL Workbench.
But when I try to run it with node.js, I fail to connect to server.
Below is index.js file I tried to run in windows command line.
var mysql = require('mysql');
var client = mysql.createConnection({
user:'root',
password:'password',
});
client.query('USE mydb');
client.query('SELECT * FROM PRODUCTS',function(error, result, fields){
if(error){
console.log(error);
} else{
console.log(result);
}
});
And it results in this error.
D:\Coding\VSCode\nodejs>node index.js
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
--------------------
at Protocol._enqueue (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:116:18)
at Connection._implyConnect (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:454:10)
at Connection.query (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:196:8)
at Object.<anonymous> (D:\Coding\VSCode\nodejs\index.js:10:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3306,
fatal: true
}
I am at the stage not knowing what I am not knowing.
I tried to change port in createConnection() function like this
var client = mysql.createConnection({
user:'root',
password:'password',
port: '9090'
});
Then I get this error.
D:\Coding\VSCode\nodejs>node index.js
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by
server; consider upgrading MySQL client
at Handshake.Sequence._packetToError
(D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Handshake.ErrorPacket
(D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
at Protocol._parsePacket (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:88:28)
at Socket.<anonymous> (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:526:10)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:309:12)
--------------------
at Protocol._enqueue (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:116:18)
at Connection._implyConnect (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:454:10)
at Connection.query (D:\Coding\VSCode\nodejs\node_modules\mysql\lib\Connection.js:196:8)
at Object.<anonymous> (D:\Coding\VSCode\nodejs\index.js:10:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading
MySQL client',
sqlState: '08004',
fatal: true
}
1.Open your windows terminal and login :
mysql -uroot -p
( then type you password )
use mysql;
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';
4 Restart you mysql db : sudo service mysql restart
Doing this in MySQL Workbench solved the problem.
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password
BY 'YourRootPassword';
FLUSH PRIVILEGES;

Error in connecting to DB: Error: Handshake inactivity timeout

I am running a node.js server which is using mysql DB. I was working fine but suddenly it has started throwing following error.
Below is the stacktrace of the error:
Error in connecting to DB: Error: Handshake inactivity timeout
at Handshake.<anonymous> (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:164:17)
at emitNone (events.js:86:13)
at Handshake.emit (events.js:185:7)
at Handshake._onTimeout (/home/ubuntu/backend/node_modules/mysql/lib/protocol/sequences/Sequence.js:129:8)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
--------------------
at Protocol._enqueue (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Protocol.handshake (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:52:23)
at PoolConnection.connect (/home/ubuntu/backend/node_modules/mysql/lib/Connection.js:130:18)
at Pool.getConnection (/home/ubuntu/backend/node_modules/mysql/lib/Pool.js:48:16)
at /home/ubuntu/backend/followcopserver.js:232:11
at Layer.handle [as handle_request] (/home/ubuntu/backend/node_modules/express/lib/router/layer.js:95:5)
at next (/home/ubuntu/backend/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/ubuntu/backend/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/ubuntu/backend/node_modules/express/lib/router/layer.js:95:5)
at
Any help is really appreciated.

Packets out of order. Got: 80 Expected: 0 node.js

Here is my (very simple) code :
var connection = mysql.createConnection(infosDB);
connection.connect()
connection.query(`SELECT * FROM action`, function(err, data){
console.log(data);
})
The action table is not empty... I think my database is ok.
This code works very well for me on localhost.
However, I bought A2 Hosting to launch node.js (v6.10.3 on localhost and server) project and I get that error when I try to launch this simple code.
{ Error: Packets out of order. Got: 80 Expected: 0
at Parser.write (/home/hello1234/public_html/myapp/node_modules/mysql/lib/protocol/Parser.js:42:19)
at Protocol.write (/home/hello1234/public_html/myapp/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/hello1234/public_html/myapp/node_modules/mysql/lib/Connection.js:103:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)
--------------------
at Protocol._enqueue (/home/hello1234/public_html/myapp/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Protocol.handshake (/home/hello1234/public_html/myapp/node_modules/mysql/lib/protocol/Protocol.js:52:23)
at Connection.connect (/home/hello1234/public_html/myapp/node_modules/mysql/lib/Connection.js:130:18)
at update_infos_all_users (/home/hello1234/public_html/myapp/app.js:570:9)
at Job.job (/home/westudec/public_html/myapp/app.js:1566:3)
at Job.invoke (/home/westudec/public_html/myapp/node_modules/node-schedule/lib/schedule.js:172:10)
at Timeout._onTimeout (/home/hello1234/public_html/myapp/node_modules/node-schedule/lib/schedule.js:542:11)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5) code: 'PROTOCOL_PACKETS_OUT_OF_ORDER', fatal: true }
The weird thing is that all work good on my computer.
Does someone have an idea ?
Thanks

PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR on node.js server using mysql DB running on Ubuntu machine

I am running a server on AWS EC2 instance on ubuntu using node.js and MYSQL.It was working fine for 3 days, suddenly it stopped working.
On Googling i found that was due to lost connection in MYSQL DB. But could not find the exact cause of the fatal.
I am using following code for MYSQL connection
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : process.env.DB_PASSWORD
});
connection.query('USE MY_DB');
And for querying like this
app.get('/user', function(req, res){
connection.query('SELECT * FROM movie', function(err, rows){
var users = {"users" : rows};
res.send(users);
});
});
And log for the fatal:
2017-01-20T00:22:23.721Z - [31merror[39m: GET /users : Error: ER_SERVER_SHUTDOWN: Server shutdown in progress
at Query.Sequence._packetToError (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
at Query.ErrorPacket (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)
at Protocol._parsePacket (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Parser.js:74:12)
at Protocol.write (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/ubuntu/myserver/node_modules/mysql/lib/Connection.js:109:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
--------------------
at Protocol._enqueue (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Connection.query (/home/ubuntu/myserver/node_modules/mysql/lib/Connection.js:214:25)
at /home/ubuntu/myserver/myserver.js:125:14
at Layer.handle [as handle_request] (/home/ubuntu/myserver/node_modules/express/lib/router/layer.js:95:5)
at next (/home/ubuntu/myserver/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/ubuntu/myserver/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/ubuntu/myserver/node_modules/express/lib/router/layer.js:95:5)
at /home/ubuntu/myserver/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/ubuntu/myserver/node_modules/express/lib/router/index.js:330:12)
at next (/home/ubuntu/myserver/node_modules/express/lib/router/index.js:271:10)
one more log:
2017-01-20T00:22:24.189Z - [31merror[39m: deleteRecords : Error: connect ECONNREFUSED 127.0.0.1:3306
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
--------------------
at Protocol._enqueue (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Protocol.handshake (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at Connection.connect (/home/ubuntu/myserver/node_modules/mysql/lib/Connection.js:136:18)
at Connection._implyConnect (/home/ubuntu/myserver/node_modules/mysql/lib/Connection.js:467:10)
at Connection.query (/home/ubuntu/myserver/node_modules/mysql/lib/Connection.js:212:8)
at Object.<anonymous> (/home/ubuntu/myserver/myserver.js:21:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
2017-01-20T00:22:28.135Z - [31merror[39m: GET /users : Error: Cannot enqueue Query after fatal error.
at Protocol._validateEnqueue (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:199:16)
at Protocol._enqueue (/home/ubuntu/myserver/node_modules/mysql/lib/protocol/Protocol.js:135:13)
at Connection.query (/home/ubuntu/myserver/node_modules/mysql/lib/Connection.js:214:25)
at /home/ubuntu/myserver/myserver.js:125:14
at Layer.handle [as handle_request] (/home/ubuntu/myserver/node_modules/express/lib/router/layer.js:95:5)
at next (/home/ubuntu/myserver/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/ubuntu/myserver/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/ubuntu/myserver/node_modules/express/lib/router/layer.js:95:5)
at /home/ubuntu/myserver/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/ubuntu/myserver/node_modules/express/lib/router/index.js:330:12)
I want to know the exact issue and the solution. Any help is appreciated.

Connecting remote mysql via local machine : node expressjs

I am trying to connect to remote mysql(hosted on digitalocean server) and using the db for code in local machine.
When I start the node server and request for data, I get the following error.
{"ERRORMSG":"Something went wrong.{\"code\":\"ENOTFOUND\",\"errno\":\"ENOTFOUND\",\"syscall\":\"getaddrinfo\",\"hostname\":\"http://ip.of.remote.server/\",\"host\":\"http://ip.of.remote.server/\",\"port\":3306,\"fatal\":true}"}
After the first attempt, if I refresh again I get different error
{\"code\":\"PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR\",\"fatal\":false}
Connection is made like this:
connection = mysql.createConnection({
connectionLimit: 10000, //important
host: 'http://ip.of.remote.server/',
user: 'user',
password: 'password',
database: 'db',
multipleStatements: true,
connectionLimit : 100,
waitForConnections : true,
queueLimit :0,
debug : true,
wait_timeout : 28800,
connect_timeout :10
});
Call is made like this
app.get('/WSgetdata', function (req, res) {
var q = "CALL sp_get_data();"
var obj = {};
connection.connect();
connection.query(q, function (err, rows) {
if (err) {
obj.ERRORMSG = JSON.stringify(err);
}
else if((rows[rows.length-1])[0].ERRORSTATUS == 0){
//do something
}
res.end(JSON.stringify(obj))
});
});
What is wrong. It works fine when code and db are on same machine.
Also I have grant access to db from desired IP.
TRACE
Trace
at Query._callback (d:/project/config\webservice.js:397:25)
at Query.Sequence.end (d:/project/node_modules\mysql\lib\protocol\sequences\Sequence.js:96:24)
at d:/project/node_modules\mysql\lib\protocol\Protocol.js:390:18
at Array.forEach (native)
at d:/project/node_modules\mysql\lib\protocol\Protocol.js:389:13
at doNTCallback0 (node.js:407:9)
at process._tickCallback (node.js:336:13)
{ [Error: getaddrinfo ENOTFOUND http://ip.of.remote.server/ http://ip.of.remote.server/:3306]
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'http://ip.of.remote.server/',
host: 'http://ip.of.remote.server/',
port: 3306,
fatal: true }
Error: getaddrinfo ENOTFOUND http://ip.of.remote.server/ http://ip.of.remote.server/:3306
at errnoException (dns.js:25:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
--------------------
at Protocol._enqueue (d:/project/node_modules\mysql\lib\protocol\Protocol.js:135:48)
at Protocol.handshake (d:/project/node_modules\mysql\lib\protocol\Protocol.js:52:41)
at Connection.connect (d:/project/node_modules\mysql\lib\Connection.js:119:18)
at d:/project/config\webservice.js:387:20
at Layer.handle [as handle_request] (d:/project/node_modules\express\lib\router\layer.js:82:5)
at next (d:/project/node_modules\express\lib\router\route.js:110:13)
at Route.dispatch (d:/project/node_modules\express\lib\router\route.js:91:3)
at Layer.handle [as handle_request] (d:/project/node_modules\express\lib\router\layer.js:82:5)
at d:/project/node_modules\express\lib\router\index.js:267:22
at Function.proto.process_params (d:/project/node_modules\express\lib\router\index.js:321:12)
Trace
at Query._callback (d:/project/config\webservice.js:397:25)
at Query.Sequence.end (d:/project/node_modules\mysql\lib\protocol\sequences\Sequence.js:96:24)
at Protocol._validateEnqueue (d:/project/node_modules\mysql\lib\protocol\Protocol.js:218:6)
at Protocol._enqueue (d:/project/node_modules\mysql\lib\protocol\Protocol.js:129:13)
at Connection.query (d:/project/node_modules\mysql\lib\Connection.js:197:25)
at d:/project/config\webservice.js:388:20
at Layer.handle [as handle_request] (d:/project/node_modules\express\lib\router\layer.js:82:5)
at next (d:/project/node_modules\express\lib\router\route.js:110:13)
at Route.dispatch (d:/project/node_modules\express\lib\router\route.js:91:3)
at Layer.handle [as handle_request] (d:/project/node_modules\express\lib\router\layer.js:82:5)
{ [Error: Cannot enqueue Query after fatal error.] code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR', fatal: false }
Error: Cannot enqueue Query after fatal error.
at Protocol._validateEnqueue (d:/project/node_modules\mysql\lib\protocol\Protocol.js:193:16)
at Protocol._enqueue (d:/project/node_modules\mysql\lib\protocol\Protocol.js:129:13)
at Connection.query (d:/project/node_modules\mysql\lib\Connection.js:197:25)
at d:/project/config\webservice.js:388:20
at Layer.handle [as handle_request] (d:/project/node_modules\express\lib\router\layer.js:82:5)
at next (d:/project/node_modules\express\lib\router\route.js:110:13)
at Route.dispatch (d:/project/node_modules\express\lib\router\route.js:91:3)
at Layer.handle [as handle_request] (d:/project/node_modules\express\lib\router\layer.js:82:5)
at d:/project/node_modules\express\lib\router\index.js:267:22
at Function.proto.process_params (d:/project/node_modules\express\lib\router\index.js:321:12)
Replace
host: 'http://ip.of.remote.server/',
with
host: 'ip.of.remote.server',