From 5b0a3ef2cc679aae6bb7c526bfc4ae2e548cc5cc Mon Sep 17 00:00:00 2001 From: Zac Date: Tue, 7 Apr 2026 09:16:24 -0400 Subject: [PATCH] Add server-side AMPP job debug logging to identify field names Logs the first job's keys and data (truncated to 1000 chars) on each /api/ampp/jobs request to help identify which field contains the asset name. Co-Authored-By: Claude Opus 4.6 --- server.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 3129a2b..66adf76 100644 --- a/server.js +++ b/server.js @@ -775,7 +775,14 @@ app.get("/api/ampp/jobs", requireAuth, async (req, res) => { return res.json({ success: true, jobs: await r2.json() }); } if (!r.ok) return res.status(r.status).json({ success: false, error: `AMPP ${r.status}` }); - res.json({ success: true, jobs: await r.json() }); + const jobData = await r.json(); + // Debug: log the first job's full structure to identify field names + const items = Array.isArray(jobData) ? jobData : (jobData?.items || jobData?.results || []); + if (items.length > 0) { + console.log("[AMPP] Sample job keys:", Object.keys(items[0])); + console.log("[AMPP] Sample job data:", JSON.stringify(items[0]).substring(0, 1000)); + } + res.json({ success: true, jobs: jobData }); } catch (err) { if (err.name === "AbortError") return res.status(504).json({ success: false, error: "AMPP timeout" }); res.status(500).json({ success: false, error: err.message });