title: Sequelize transaction error
body: <p>Trying to implement oauth2. Stuck with sequelize transactions. </p>
  
  <p>Getting error: </p>
  
  <blockquote>
    <p>Executing (9edf48f7-5823-4b4f-b444-faa4c1896831): START TRANSACTION;</p>
    
    <p>Executing (9edf48f7-5823-4b4f-b444-faa4c1896831): COMMIT;</p>
    
    <p>Unhandled rejection Error: commit has been called on this
    transaction(9edf48f7-5823-4b4f-b444-faa4c1896831), you can no longer
    use it. (The rejected query is attached as the 'sql' property of this
    error)</p>
  </blockquote>
  
  <p>`</p>
  
  <pre><code>at.save({transaction: t}).then(() =&gt; {
                  rt.save({transaction: t}).then(() =&gt; {
                      t.commit();
                      return done(false, accessToken, refreshToken, {
                          expires_at: expires,
                          scope: scope});
                  }).error(function(
                      err) {
                      t.rollback();
                      return done(err);
                  });
              }).error(function(err) {
                  t.rollback();
                  return done(err);
              });
  </code></pre>
  
  <p>Sequelize 4.x.x with Postgres </p>