A local-first personal finance app
:chart_with_upwards_trend: adding extra console.log lines for bank-sync to help with troubleshooting (#2529)
Matiss Janis Aboltins270705b3cd56
diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.tsindex c7709c728d..494759b727 100644--- a/packages/loot-core/src/server/accounts/sync.ts+++ b/packages/loot-core/src/server/accounts/sync.ts@@ -185,6 +185,8 @@ async function downloadGoCardlessTransactions(const userToken = await asyncStorage.getItem('user-token');if (!userToken) return;+ console.log('Pulling transactions from GoCardless');+const res = await post(getServer().GOCARDLESS_SERVER + '/transactions',{@@ -209,6 +211,8 @@ async function downloadGoCardlessTransactions(startingBalance,} = res;+ console.log('Response:', res);+return {transactions: all,accountBalance: balances,@@ -220,6 +224,8 @@ async function downloadSimpleFinTransactions(acctId, since) {const userToken = await asyncStorage.getItem('user-token');if (!userToken) return;+ console.log('Pulling transactions from SimpleFin');+const res = await post(getServer().SIMPLEFIN_SERVER + '/transactions',{@@ -241,6 +247,8 @@ async function downloadSimpleFinTransactions(acctId, since) {startingBalance,} = res;+ console.log('Response:', res);+return {transactions: all,accountBalance: balances,@@ -430,6 +438,8 @@ async function createNewPayees(payeesToCreate, addsAndUpdates) {}export async function reconcileExternalTransactions(acctId, transactions) {+ console.log('Performing transaction reconciliation');+const hasMatched = new Set();const updated = [];const added = [];@@ -606,6 +616,14 @@ export async function reconcileExternalTransactions(acctId, transactions) {await createNewPayees(payeesToCreate, [...added, ...updated]);await batchUpdateTransactions({ added, updated });+ console.log('Debug data for the operations:', {+ transactionsStep1,+ transactionsStep2,+ transactionsStep3,+ added,+ updated,+ });+return {added: added.map(trans => trans.id),updated: updated.map(trans => trans.id),diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.tsindex b5e3c0d49a..0cc70892db 100644--- a/packages/loot-core/src/server/main.ts+++ b/packages/loot-core/src/server/main.ts@@ -1287,6 +1287,7 @@ handlers['gocardless-accounts-sync'] = async function ({ id }) {const acct = accounts[i];if (acct.bankId) {try {+ console.group('Bank Sync operation');const res = await bankSync.syncExternalAccount(userId,userKey,@@ -1294,6 +1295,8 @@ handlers['gocardless-accounts-sync'] = async function ({ id }) {acct.account_id,acct.bankId,);+ console.groupEnd();+const { added, updated } = res;newTransactions = newTransactions.concat(added);diff --git a/upcoming-release-notes/2529.md b/upcoming-release-notes/2529.mdnew file mode 100644index 0000000000..9672c40f22--- /dev/null+++ b/upcoming-release-notes/2529.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MatissJanis]+---++Adding extra `console.log` lines to the bank-sync operation to improve troubleshooting