diff --git a/app/api/webhooks/trigger/[path]/route.ts b/app/api/webhooks/trigger/[path]/route.ts index 94f46682a0..23910fd926 100644 --- a/app/api/webhooks/trigger/[path]/route.ts +++ b/app/api/webhooks/trigger/[path]/route.ts @@ -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> ) + 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}`) diff --git a/executor/handlers.ts b/executor/handlers.ts index 8345f9fbb8..454fd2ea58 100644 --- a/executor/handlers.ts +++ b/executor/handlers.ts @@ -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`)