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 <noreply@anthropic.com>
This commit is contained in:
Zac Gaetano 2026-04-07 09:16:24 -04:00
parent ecdfe0f7cd
commit 5b0a3ef2cc

View file

@ -775,7 +775,14 @@ app.get("/api/ampp/jobs", requireAuth, async (req, res) => {
return res.json({ success: true, jobs: await r2.json() }); return res.json({ success: true, jobs: await r2.json() });
} }
if (!r.ok) return res.status(r.status).json({ success: false, error: `AMPP ${r.status}` }); 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) { } catch (err) {
if (err.name === "AbortError") return res.status(504).json({ success: false, error: "AMPP timeout" }); if (err.name === "AbortError") return res.status(504).json({ success: false, error: "AMPP timeout" });
res.status(500).json({ success: false, error: err.message }); res.status(500).json({ success: false, error: err.message });