Sequelize transaction error

Viewed 18426

Trying to implement oauth2. Stuck with sequelize transactions.

Getting error:

Executing (9edf48f7-5823-4b4f-b444-faa4c1896831): START TRANSACTION;

Executing (9edf48f7-5823-4b4f-b444-faa4c1896831): COMMIT;

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)

`

at.save({transaction: t}).then(() => {
                rt.save({transaction: t}).then(() => {
                    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);
            });

Sequelize 4.x.x with Postgres

1 Answers
Related