title: NPM MSSQL - error: uncaughtException: Cannot read property 'release' of null
body: <p>I am trying to connect to the mssql server using <a href="https://www.npmjs.com/package/mssql" rel="nofollow noreferrer">npm mssql</a> module. I am getting below mentioned error, I tried to search about it and couldn't find anything helpful on it apart from few users already reported it on <a href="https://github.com/patriksimek/node-mssql/issues/467" rel="nofollow noreferrer">GitHub</a> without any success.</p>
  
  <pre><code>error: uncaughtException: Cannot read property 'release' of null date=Sat Jul 15 2017 02:03:59 GMT+0000 (UTC), pid=10150, uid=1000, gid=1000, cwd=/home/ubuntu/server/gcap-server-exp, execPath=/usr/bin/nodejs, version=v6.11.1, argv=[/usr/bin/nodejs, /usr/lib/node_modules/pm2/lib/ProcessContainerFork.js], rss=70537216, heapTotal=47235072, heapUsed=35834656, external=18214141, loadavg=[0.14794921875, 0.10498046875, 0.02880859375], uptime=2206463
  TypeError: Cannot read property 'release' of null
      at ConnectionPool.release (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/mssql/lib/base.js:199:14)
      at Request.tds.Request.err [as userCallback] (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/mssql/lib/tedious.js:892:25)
      at Request._this.callback (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/tedious/lib/request.js:47:27)
      at Connection.message (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/tedious/lib/connection.js:1401:27)
      at Connection.dispatchEvent (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/tedious/lib/connection.js:687:45)
      at MessageIO.&lt;anonymous&gt; (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/tedious/lib/connection.js:602:18)
      at emitNone (events.js:86:13)
      at MessageIO.emit (events.js:185:7)
      at ReadablePacketStream.&lt;anonymous&gt; (/home/ubuntu/server/gcap-server-exp/node_modules/atpl-models/node_modules/tedious/lib/message-io.js:102:16)
      at emitOne (events.js:96:13)
  </code></pre>
  
  <p>My code for creating a connection and executing the procedure is as follows -</p>
  
  <pre><code>sql.close()
  sql.connect(sqlConfig).then(pool =&gt; {
    return pool.request()
      .input('input', sql.NVarChar, input_value)
      .execute('someProcedure').then(result =&gt; {
        result.recordsets.forEach(record =&gt; {
          record.forEach(recordChild =&gt; {
           // Do something about the recordChild ...
          })
        })
      }, err =&gt; {
        // Log err
        console.log(err)
      }).catch(err =&gt; {
        // ... error checks 
        console.log(err)
      })
  })
  </code></pre>
  
  <p>The <code>sqlConfig</code> parameter above is -</p>
  
  <pre><code>sqlConfig = {
    user: 'username',
    password: '******',
    server: 'xxx.xxx.xxx.xxx',
    database: 'database',
    pool: {
      max: 10,
      min: 0,
      idleTimeoutMillis: 30000
    }
  }
  </code></pre>