npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

sails-postgresql module - Sails Server restarts very frequently on DB calls to Postgres DB

What I Wanted to Do

I am trying to save data to Postgres DB using ‘sails-postgresql’ module, using Node 10

What Happened Instead

It saves the data but Sails server gets restarted every now or then after some DB calls.

Reproduction Steps

Node version : 10.15.3
Sails version (sails) : ~0.12.13
DB adapter & version (e.g. sails-mysql@5.55.5) :“sails-postgresql”: “~0.11.3”
Try to do some DB operations - multiple saves, and it’ll restart Sails server automatically.


I get these errors very frequently when using Node 10, and Sails server restarts every now and then.
my application works well with Node 8, with no issues of server restart.

[34mdebug: [39m-------------------------------------------------------
[34mdebug: [39m-------------------------------------------------------
[34mdebug: [39mEnvironment : development
[34mdebug: [39mPort        : 8080
[34mdebug: [39m:: Tue Jul 23 2019 20:50:20 GMT+0000 (Coordinated Universal Time)
[32minfo: [39mTo see your app, visit http://localhost:8080
[32minfo: [39mTo shut down Sails, press <CTRL> + C at any time.
[32minfo: [39m
[32minfo: [39mServer lifted in `/home/vcap/app`
[32minfo: [39m                   ,'  |'  \
[32minfo: [39m                .-'.-==|/_--'
[32minfo: [39m                `--'-------' 
[32minfo: [39m   v0.12.14            |\
[32minfo: [39m                      /|.\
[32minfo: [39m                     / || \
[32minfo: [39m   __---___--___---___--___---___--___
[32minfo: [39m ____---___--___---___--___---___--___-__
[32minfo: [39m   Sails              <|    .-..-.
[32minfo: [39m
[32minfo: [39m               .-..-.
[32minfo: [39m
Initializing isso module
Starting health monitoring of container
Downloaded droplet (64.1M)
Cell f4149496-46f5-49e3-8607-513c579d5d91 successfully destroyed container for instance cba2aa51-0759-4513-6cd5-1587
Downloading droplet...
Cell c72ae9f0-37c6-4fb2-a442-005a4c9a80e3 successfully created container for instance 8aef0860-deeb-41f4-58a8-3804
Cell c72ae9f0-37c6-4fb2-a442-005a4c9a80e3 creating container for instance 8aef0860-deeb-41f4-58a8-3804
Cell f4149496-46f5-49e3-8607-513c579d5d91 destroying container for instance cba2aa51-0759-4513-6cd5-1587
Cell f4149496-46f5-49e3-8607-513c579d5d91 stopping instance cba2aa51-0759-4513-6cd5-1587
Exit status 0
Exit status 1
    at Connection.EventEmitter.emit (domain.js:441:20)
    at TLSSocket.EventEmitter.emit (domain.js:441:20)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
    at Client.<anonymous> (/home/vcap/deps/0/node_modules/sails-postgresql/node_modules/pg/lib/pool.js:39:20)
    at Client.EventEmitter.emit (domain.js:441:20)
    at Connection.<anonymous> (/home/vcap/deps/0/node_modules/sails-postgresql/node_modules/pg/lib/client.js:174:19)
    at TLSSocket.<anonymous> (/home/vcap/deps/0/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:94:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Error: read ECONNRESET
    at Object.emit (events.js:189:13)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
      throw er; // Unhandled 'error' event
    at Object.EventEmitter.emit (domain.js:441:20)
    at Client.emit (events.js:189:13)
    at Connection.emit (events.js:189:13)
    at TLSSocket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)

Platform Info

$ npm --versions
$ node -p process.platform

You might get an answer here, but because this forum is focused on npm itself, you are more likely to get an answer asking somewhere that targets experts with sails-postgresql. (I have moved your topic to #community:javascript.)