Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix: missed transaction
Daniel Hougaardccb757ec3e87
diff --git a/backend/src/services/auth-token/auth-token-dal.ts b/backend/src/services/auth-token/auth-token-dal.tsindex ed45d505e7..221b691cfd 100644--- a/backend/src/services/auth-token/auth-token-dal.ts+++ b/backend/src/services/auth-token/auth-token-dal.ts@@ -12,9 +12,12 @@ export type TTokenDALFactory = ReturnType<typeof tokenDALFactory>;export const tokenDALFactory = (db: TDbClient) => {const authOrm = ormify(db, TableName.AuthTokens);- const findOneTokenSession = async (filter: Partial<TAuthTokenSessions>): Promise<TAuthTokenSessions | undefined> => {+ const findOneTokenSession = async (+ filter: Partial<TAuthTokenSessions>,+ tx?: Knex+ ): Promise<TAuthTokenSessions | undefined> => {try {- const doc = await db.replicaNode()(TableName.AuthTokenSession).where(filter).first();+ const doc = await (tx || db.replicaNode())(TableName.AuthTokenSession).where(filter).first();return doc;} catch (error) {throw new DatabaseError({ error, name: "FindOneTokenSession" });diff --git a/backend/src/services/auth-token/auth-token-service.ts b/backend/src/services/auth-token/auth-token-service.tsindex b9fc98106b..c0bb7dc17c 100644--- a/backend/src/services/auth-token/auth-token-service.ts+++ b/backend/src/services/auth-token/auth-token-service.ts@@ -128,7 +128,7 @@ export const tokenServiceFactory = ({ tokenDAL, userDAL, orgMembershipDAL }: TAu{ userId, ip, userAgent }: TIssueAuthTokenDTO,tx?: Knex): Promise<TAuthTokenSessions | undefined> => {- let session = await tokenDAL.findOneTokenSession({ userId, ip, userAgent });+ let session = await tokenDAL.findOneTokenSession({ userId, ip, userAgent }, tx);if (!session) {session = await tokenDAL.insertTokenSession(userId, ip, userAgent, tx);}