From 140a2fa218c664f35bfc74a60b91cef729c221f2 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Sun, 30 Nov 2025 01:42:04 +1000 Subject: [PATCH] fix: mark AI tool execution route as dynamic to prevent build-time WASM error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add `export const dynamic = 'force-dynamic'` to `/api/tools/execute/[...slug]` to prevent Next.js from attempting static generation at build time. The AI SDK (used via executeToolWithAgent) requires tiktoken_bg.wasm which cannot be loaded during static generation. Marking as dynamic ensures the route is only executed at runtime. Note: This partially addresses the build error but further investigation needed for complete resolution of tiktoken WASM loading in Next.js 16 + Turbopack. Relates to: "Error: Missing tiktoken_bg.wasm" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- apps/web/src/app/api/tools/execute/[...slug]/route.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/src/app/api/tools/execute/[...slug]/route.ts b/apps/web/src/app/api/tools/execute/[...slug]/route.ts index a56942c..a9e54d0 100644 --- a/apps/web/src/app/api/tools/execute/[...slug]/route.ts +++ b/apps/web/src/app/api/tools/execute/[...slug]/route.ts @@ -11,6 +11,7 @@ import { type NextRequest, NextResponse } from 'next/server'; // Use Node.js runtime for SSE streaming export const runtime = 'nodejs'; export const maxDuration = 60; // 60 seconds timeout +export const dynamic = 'force-dynamic'; // Prevent static generation for AI SDK routes interface ExecuteRequest { prompt: string;