PostgreSQL 9.6.2 I send requests from the node.js + sequelize application

The sequelize documentation has examples of querying, in this case, findAll

Trying an example

console.log('user id: ', req.decoded); db.orders.findAll({where: {userId: req.decoded.id}}) .then(function (orders) { console.log('orders from db: ', orders); }) .catch(function (err) { console.log('orders request error from db: ', err); }); console.log('end of function'); 

Console log

 user id: { id: 2 } end of function orders request error from db: { SequelizeConnectionError: read ECONNRESET at D:\NodeJSProjects\ParkingHouse\node_modules\sequelize\lib\dialects\postgres\connection-manager.js:110:20 at Connection.<anonymous> (D:\NodeJSProjects\ParkingHouse\node_modules\pg\lib\client.js:186:5) at emitOne (events.js:96:13) at Connection.emit (events.js:188:7) at Socket.<anonymous> (D:\NodeJSProjects\ParkingHouse\node_modules\pg\lib\connection.js:86:10) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at emitErrorNT (net.js:1278:8) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) name: 'SequelizeConnectionError', message: 'read ECONNRESET', parent: { Error: read ECONNRESET at exports._errnoException (util.js:1022:11) at TCP.onread (net.js:569:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }, original: { Error: read ECONNRESET at exports._errnoException (util.js:1022:11) at TCP.onread (net.js:569:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' } } 

after some time, the request is repeated and already then I receive the data and the database.

  1. Why does the server stop the connection?
  2. Should the request be wrapped in a promise to wait for an answer?
  • But this database does not have a similar option, like MongoDB - socketOptions: {keepAlive: 1}? No, this is not the answer, I’m pure for the sake of interest, I suppose - maybe it is there, and it only needs to be indicated when connecting. - Yuriy Po

1 answer 1

The problem was in the antivirusnik F-Secure, put another, everything works. https://community.f-secure.com/t5/Business/DeepGuard-seems-to-cause/td-p/88447 http://holdemmanager.nlclub.org/faq/339.html#F-Secure