From 3c1346bd1ad06af5305b88f0ab73825e7cfcbd76 Mon Sep 17 00:00:00 2001 From: riz Date: Thu, 20 Nov 2025 02:06:04 +0000 Subject: [PATCH] Add comprehensive request debugging to isolate hanging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Log every incoming request with method, URL, and headers - Add try-catch around entire fetch handler with stack traces - Force development mode to false for production behavior - This will show exactly where requests are failing or hanging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pkgs/server/create.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/server/create.ts b/pkgs/server/create.ts index 454e097..b18b7cd 100644 --- a/pkgs/server/create.ts +++ b/pkgs/server/create.ts @@ -87,8 +87,12 @@ export const createServer = async () => { port: g.port, maxRequestBodySize: 1024 * 1024 * 128, hostname: "0.0.0.0", // Explicitly bind to all interfaces + development: false, // Force production mode async fetch(req) { - const url = new URL(req.url) as URL; + console.log(`[DEBUG] Request received: ${req.method} ${req.url}`); + console.log(`[DEBUG] Request headers:`, Object.fromEntries(req.headers.entries())); + try { + const url = new URL(req.url) as URL; url.pathname = url.pathname.replace(/\/+/g, "/"); const prasi = {}; @@ -185,7 +189,15 @@ export const createServer = async () => { } } - return handle(req); + return handle(req); + } catch (fetchError) { + console.error(`[ERROR] Fetch handler error:`, fetchError); + console.error(`[ERROR] Stack trace:`, fetchError.stack); + return new Response(`Fetch Handler Error: ${fetchError.message}`, { + status: 500, + statusText: "Internal Server Error", + }); + } }, error(error) { console.error(`[ERROR] Server error:`, error);