Add comprehensive request debugging to isolate hanging

- 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 <noreply@anthropic.com>
This commit is contained in:
riz 2025-11-20 02:06:04 +00:00
parent cd3fc84db5
commit 3c1346bd1a
1 changed files with 14 additions and 2 deletions

View File

@ -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);