Problem
GC’s locked on 2024-12.960.0. The Express middleware catches script.action.completed events fine when agents actually finish steps. Payload comes through clean, JWT validates, everything’s flowing into the DB. Agent decides to skip a step, though. Middleware crashes hard.
The payload structure shifts completely. stepId disappears from the root object. data field shows up as an empty object instead of the step definition. interactionId is still there, so we know which call this is, but without the step reference, the middleware’s doing jack all. Express tries to map the completion and throws a TypeError. This broke our reporting pipeline for the morning shift. Retries aren’t helping because the payload never recovers.
app.post('/webhook/script', (req, res) => {
const event = req.body;
// JWT check passed earlier, signature's valid
const step = event.stepId;
// Boom. step is undefined on skip.
console.log('Processing step:', step);
res.status(200).send();
});
Logs show the event type is correct, but the nesting is off. action field says SKIP but the rest of the object looks like a ghost. Architect flow is v4.2.1. Is this a known quirk with script actions? Or does the webhook payload just drop the identifier when no action data exists?
TypeError: Cannot read properties of undefined (reading ‘id’)
at ServerResponse.processScriptEvent (/app/middleware/scriptHandler.js:42:15)
at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
at next (/node_modules/express/lib/router/route.js:144:13)
at validateJwt (/app/middleware/auth.js:18:5)