fix: adding debug logs to figure out response format issue

This commit is contained in:
Waleed Latif
2025-03-11 15:04:43 -07:00
parent 5030fdb537
commit 8e37172377
2 changed files with 10 additions and 3 deletions
+6 -2
View File
@@ -338,8 +338,6 @@ async function processWebhook(
},
}
} else {
// This might be a different type of notification (e.g., status update)
console.log('No messages in WhatsApp payload, might be a status update')
return new NextResponse('OK', { status: 200 })
}
} else {
@@ -448,6 +446,11 @@ async function processWebhook(
{} as Record<string, Record<string, any>>
)
console.log(`[Webhook Debug] Serialized workflow:`, serializedWorkflow)
console.log(`[Webhook Debug] Processed block states:`, processedBlockStates)
console.log(`[Webhook Debug] Decrypted env vars:`, decryptedEnvVars)
console.log(`[Webhook Debug] Enriched input:`, enrichedInput)
const executor = new Executor(
serializedWorkflow,
processedBlockStates,
@@ -455,6 +458,7 @@ async function processWebhook(
enrichedInput
)
const result = await executor.execute(foundWorkflow.id)
console.log(`[Webhook Debug] Final execution result:`, JSON.stringify(result))
console.log(`Successfully executed workflow ${foundWorkflow.id}`)
+4 -1
View File
@@ -303,7 +303,7 @@ export class AgentBlockHandler implements BlockHandler {
const parsedContent = JSON.parse(response.content)
console.log(`[AgentBlockHandler Debug] Successfully parsed content:`, parsedContent)
return {
const result = {
...parsedContent,
tokens: response.tokens || {
prompt: 0,
@@ -317,6 +317,9 @@ export class AgentBlockHandler implements BlockHandler {
}
: undefined,
}
console.log(`[AgentBlockHandler Debug] Result:`, result)
return result
} catch (error) {
console.error(`[AgentBlockHandler Error] Failed to parse response content:`, error)
console.log(`[AgentBlockHandler Debug] Falling back to standard response format`)