ZZZ Digital Lab

Back to n8n workflow hardening

code/build_incident.js

// SYNTHETIC. Safe summary, no raw error stack or payload forwarded to incident sink.
const input = $input.first().json;
const identity = input.execution?.id || input.trigger?.timestamp;
if (!identity) throw new Error('INCIDENT_ID_MISSING');
return [{json:{synthetic:true,incident_key:'incident:' + String(identity),
  workflow_id:String(input.workflow?.id || 'unknown').slice(0,80),
  reason:'WORKFLOW_FAILED',action:'Inspect local execution and dead-letter store'}}];