From c8492807054501791c86512f5c6d0910123dbe2f Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Tue, 14 Apr 2026 20:15:41 -0400 Subject: [PATCH] Improve BoA API error logging and update .gitignore Read response as text before JSON parsing to capture non-JSON error responses from BoA API. Add .DS_Store, BofA API Resources, and CSV files to .gitignore. --- .gitignore | 3 +++ src/processPaymentCsv.js | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 24a0e44..e469f0d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ node_modules/ .aws-sam/ samconfig.toml data/ +.DS_Store +BofA API Resources/ +*.csv diff --git a/src/processPaymentCsv.js b/src/processPaymentCsv.js index 51f2a87..f8fdb41 100644 --- a/src/processPaymentCsv.js +++ b/src/processPaymentCsv.js @@ -223,13 +223,15 @@ export const handler = async (event) => { } ); - const data = await res.json(); + const text = await res.text(); if (!res.ok) { - console.error(`BoA ${action} error ${res.status}:`, JSON.stringify(data)); + console.error(`BoA ${action} error ${res.status}:`, text); throw new Error(`BoA ${action} failed: ${res.status}`); } + const data = JSON.parse(text); + console.log( `BoA ${action}: ${data.processedItems}/${data.totalItems} processed, ${data.unprocessedItems} failed` );