🐛 Fix webhook listening error when body is not JSON

This commit is contained in:
Baptiste Arnaud 2025-05-05 15:08:05 +02:00
parent e1c7c27667
commit 9a1907d7c7
No known key found for this signature in database

View File

@ -283,11 +283,16 @@ const processNonInputBlock = async ({
try {
response = JSON.parse(reply.text);
} catch (err) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "Provided response is not valid JSON",
cause: (await parseUnknownError({ err })).description,
});
if (block.type === IntegrationBlockType.HTTP_REQUEST)
throw new TRPCError({
code: "BAD_REQUEST",
message: "Provided response is not valid JSON",
cause: (await parseUnknownError({ err })).description,
});
response = {
statusCode: 200,
data: reply.text,
};
}
const result = saveDataInResponseVariableMapping({
state,