From 1d41d27b2b4b3e60215e92586e1b590b400b04c0 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 24 Apr 2026 15:51:16 +0700 Subject: [PATCH] =?UTF-8?q?fix(webhook):=20bump=20grammY=20timeout=2010s?= =?UTF-8?q?=20=E2=86=92=2025s=20for=20LLM=20call=20headroom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Production showed: Request timed out after 10000 ms / status 500. grammY's webhookCallback defaults to 10s — fine for simple handlers but too tight for twentyq's Workers AI call (Gemma 4 26B cold-starts can easily exceed 10s). Raise to 25s, leaving 5s headroom under Cloudflare Workers' 30s wall-clock cap. --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index a73d603..fa92ea4 100644 --- a/src/index.js +++ b/src/index.js @@ -27,6 +27,9 @@ async function getWebhookHandler(env) { const bot = await getBot(env); cachedWebhookHandler = webhookCallback(bot, "cloudflare-mod", { secretToken: env.TELEGRAM_WEBHOOK_SECRET, + // Default is 10s — too short for LLM calls (Gemma 4 cold-start can exceed). + // Workers wall-clock limit is 30s; leave 5s headroom. + timeoutMilliseconds: 25000, }); return cachedWebhookHandler; }