I am currently in charge of a system developed in NodeJS, which uses PostgreSQL as a database, and we access it using the Sequelize ORM, all this in the Heroku platform.
The problem I face is that, at a certain point, I tried to make a new deploy with changes in some functionalities, but after 1 or 2 minutes after deploying the deploy, all database queries start generating the same error, described in the following log:
2017-03-09T16:17:10.619517+00:00 app[web.1]: TypeError: "listener" argument must be a function
2017-03-09T16:17:10.619534+00:00 app[web.1]: at Socket.once (events.js:307:11)
2017-03-09T16:17:10.619535+00:00 app[web.1]: at Socket.connect (net.js:943:10)
2017-03-09T16:17:10.619536+00:00 app[web.1]: at wrappedConnect (/app/node_modules/newrelic/lib/instrumentation/core/net.js:53:31)
2017-03-09T16:17:10.619536+00:00 app[web.1]: at wrapped (/app/node_modules/newrelic/lib/transaction/tracer/index.js:183:28)
2017-03-09T16:17:10.619537+00:00 app[web.1]: at Tracer.addSegment (/app/node_modules/newrelic/lib/transaction/tracer/index.js:83:48)
2017-03-09T16:17:10.619538+00:00 app[web.1]: at Socket.connectWrapper [as connect] (/app/node_modules/newrelic/lib/instrumentation/core/net.js:43:27)
2017-03-09T16:17:10.619539+00:00 app[web.1]: at Connection.connect (/app/node_modules/pg/lib/connection.js:42:17)
2017-03-09T16:17:10.619540+00:00 app[web.1]: at Client.connect (/app/node_modules/pg/lib/client.js:47:9)
2017-03-09T16:17:10.619540+00:00 app[web.1]: at Promise.tap.query (/app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:56:16)
2017-03-09T16:17:10.619541+00:00 app[web.1]: at Promise.wrappedExecutorCaller [as _resolveFromResolver] (/app/node_modules/newrelic/lib/instrumentation/promise.js:200:18)
2017-03-09T16:17:10.619542+00:00 app[web.1]: at new Promise (/app/node_modules/bluebird/js/main/promise.js:69:37)
2017-03-09T16:17:10.619543+00:00 app[web.1]: at ConnectionManager.connect (/app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:52:10)
2017-03-09T16:17:10.619544+00:00 app[web.1]: at ConnectionManager.$connect (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:204:41)
2017-03-09T16:17:10.619545+00:00 app[web.1]: at Object.create (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:74:14)
2017-03-09T16:17:10.619545+00:00 app[web.1]: at createResource (/app/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:261:13)
2017-03-09T16:17:10.619546+00:00 app[web.1]: at dispense (/app/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:253:9)
As you can see (unless you are looking at it badly), the log does not refer to any method, file, at any point of the project, only to libraries (those that are within node_modules
). I would even expect that at the top of the stack of errors it would appear which is the Sequelize query that generates error, but it is not a single one, for all it generates the same.
This same deploy has been tested both locally and on a staging server, which is another Heroku application for testing, and this error is not generated. It only appears in production time.
I have managed to leave the stable system rollback to the last successful commit, but here another problem arises that leads to the same error log. If I try to do commit & push of the same code associated to that point of the system, the same error starts to be generated, even when technically I'm not uploading anything new, only a copy of the code (let's say with a blank space of more only) than it is currently working well on the server.
I would appreciate any help, if I have left any technical or methodological details on the way. Of course I have already searched the internet, but without positive results.