From c0bbcba507f38bb98560815abb614caee9d398de Mon Sep 17 00:00:00 2001 From: alma Date: Sat, 24 May 2025 18:18:48 +0200 Subject: [PATCH] W n8n attention vm --- app/api/missions/route.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/api/missions/route.ts b/app/api/missions/route.ts index 17980a51..013c1536 100644 --- a/app/api/missions/route.ts +++ b/app/api/missions/route.ts @@ -246,6 +246,15 @@ export async function POST(request: Request) { const firstResult = workflowResult.results[0]; console.log('First result from workflow:', JSON.stringify(firstResult, null, 2)); + // Check if the result is HTML (error case) + if (typeof firstResult === 'string' && firstResult.includes('')) { + console.error('Received HTML response instead of JSON:', firstResult); + return NextResponse.json({ + error: 'Invalid response from workflow', + details: 'Received HTML instead of JSON data' + }, { status: 500 }); + } + if (firstResult && firstResult.json && firstResult.json.logoPath) { logoPath = firstResult.json.logoPath; console.log('Extracted logo path:', logoPath);