Cannot call method 'ReleaseConnection' of null
참조 페이지https://github.com/dougwilson/node-mysql/commit/ef13ca08dfc8025a93c607656119b7abb3b3b2aa
// Release Connection시 에러가 날 때가 있는데요.
// 해결 방법입니다.
// lib/PoolConnection.js 수정하기
PoolConnection.prototype.release = function () {
if (!this._pool || this._pool._closed) {
return;
}
return this._pool.releaseConnection(this);
};
// test/integration/pool/test-destroy-connection.js 수정하기
var common = require('../../common');
var assert = require('assert');
var Connection = require(common.lib + '/Connection');
var pool = common.createPool();
pool.getConnection(function(err, connection) {
if (err) throw err;
assert.strictEqual(connection, pool._allConnections[0]);
connection.destroy();
assert.ok(pool._allConnections.length == 0);
assert.ok(!connection._pool);
assert.doesNotThrow(function () { connection.release(); });
pool.end();
});