From eff4fc922b7534de28bde390e14f41728c7b2d84 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Wed, 4 Feb 2026 09:05:48 -0800 Subject: [PATCH] fix cleanup base64 sse --- apps/sim/app/api/workflows/[id]/execute/route.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/sim/app/api/workflows/[id]/execute/route.ts b/apps/sim/app/api/workflows/[id]/execute/route.ts index dd2273190..05de03b09 100644 --- a/apps/sim/app/api/workflows/[id]/execute/route.ts +++ b/apps/sim/app/api/workflows/[id]/execute/route.ts @@ -458,8 +458,6 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: }) await loggingSession.markAsFailed(timeoutErrorMessage) - await cleanupExecutionBase64Cache(executionId) - return NextResponse.json( { success: false, @@ -487,9 +485,6 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: const resultWithBase64 = { ...result, output: outputWithBase64 } - // Cleanup base64 cache for this execution - await cleanupExecutionBase64Cache(executionId) - const hasResponseBlock = workflowHasResponseBlock(resultWithBase64) if (hasResponseBlock) { return createHttpResponseFromBlock(resultWithBase64) @@ -539,6 +534,13 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: ) } finally { timeoutController.cleanup() + if (executionId) { + try { + await cleanupExecutionBase64Cache(executionId) + } catch (error) { + logger.error(`[${requestId}] Failed to cleanup base64 cache`, { error }) + } + } } }