Help me with this node pls!

Please check this script from a code node and help me to understand why is it that there is a valid input to the node, but no output is coming out, not even an error. This is the script:
const item = $json;

// Verifica que item tenga la estructura esperada directamente
if (!item?.input || !item?.sessionId) {
throw new Error(“Formato de entrada inválido. Se requieren ‘input’ y ‘sessionId’”);
}

// Devuelve el output estructurado correctamente
return {
json: {
input: item.input,
sessionId: item.sessionId,
debug: “directo_desde_webhook”
}
};
! Captura de pantalla 2025-06-13 a la(s) 7.57.00 a.m.|690x371

Try

const item = $json;

if (!item?.input || !item?.sessionId) {
    throw new Error("Formato de entrada inválido. Se requieren 'input' y 'sessionId'");
}

return [{
    json: {
        input: item.input,
        sessionId: item.sessionId,
        debug: "directo_desde_webhook"
    }
}];

If you’re still not getting output after this fix, add a console.log before the return statement to verify your input data structure:

console.log("Input data:", JSON.stringify(item, null, 2));
1 Like

Didn’t work, but thanks, it gave me the right direction.