From 9a1907d7c7aff2cbd4b61a5efcd6fecb350164ea Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 5 May 2025 15:08:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20webhook=20listening=20erro?= =?UTF-8?q?r=20when=20body=20is=20not=20JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/bot-engine/src/continueBotFlow.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/bot-engine/src/continueBotFlow.ts b/packages/bot-engine/src/continueBotFlow.ts index 9e53ff402..1a9b0d53f 100644 --- a/packages/bot-engine/src/continueBotFlow.ts +++ b/packages/bot-engine/src/continueBotFlow.ts @@ -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,