fix: reduce maxDuration to 60s for Vercel Hobby plan compatibility

Routes with maxDuration=300 were silently failing on Vercel's edge
routing layer - requests never reached the serverless function (no
logs appeared). Vercel Hobby plan has a 60s max function duration.

Affected routes:
- /api/agents/[id]/conversation/[conversationId]
- /api/agents/[username]/[uid]/conversation/[conversationId]
- /api/mcp/[username]/[slug]/[transport]

The issue caused these routes to hang indefinitely until client timeout.
This commit is contained in:
Ajax Davis 2026-01-09 07:06:54 +10:00
parent 9b6a4a625e
commit 4c5972adc4
5 changed files with 908 additions and 13 deletions

View file

@ -88,17 +88,9 @@ export async function POST(req: NextRequest): Promise<NextResponse<ExecuteToolRe
});
}
// 2) Build environment setup for the script
const envSetup = env
? Object.entries(env)
.map(([key, value]) => `process.env[${JSON.stringify(key)}] = ${JSON.stringify(value)};`)
.join('\n')
: '';
// 3) Write the execution script (CommonJS for require())
// 2) Write the execution script (CommonJS for require())
// Note: env vars are passed via runCommand's env option, not embedded in script
const script = `
${envSetup}
(async () => {
try {
const pkg = require(${JSON.stringify(packageName)});