Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(CustomKnex): handle callback transactions in custom transaction method

Pranav C6ab0fbe2d843
diff --git a/packages/nocodb/src/db/CustomKnex.ts b/packages/nocodb/src/db/CustomKnex.ts
index d4671306bf..07fe034d03 100644
--- a/packages/nocodb/src/db/CustomKnex.ts
+++ b/packages/nocodb/src/db/CustomKnex.ts
@@ -1102,6 +1102,12 @@ function CustomKnex(
transaction: {
enumerable: true,
value: async (...args: any[]) => {
+ // if transaction using callback, return directly without decorating
+ // TODO: handle nested callback transactions
+ if (typeof args[0] === 'function') {
+ return knexTransaction(...args);
+ }
+
const trx: CustomTransaction = await knexTransaction(...args);
const trxRaw = trx.raw.bind(trx);