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:
parent
cd3fc84db5
commit
3c1346bd1a
|
|
@ -87,7 +87,11 @@ export const createServer = async () => {
|
||||||
port: g.port,
|
port: g.port,
|
||||||
maxRequestBodySize: 1024 * 1024 * 128,
|
maxRequestBodySize: 1024 * 1024 * 128,
|
||||||
hostname: "0.0.0.0", // Explicitly bind to all interfaces
|
hostname: "0.0.0.0", // Explicitly bind to all interfaces
|
||||||
|
development: false, // Force production mode
|
||||||
async fetch(req) {
|
async fetch(req) {
|
||||||
|
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;
|
const url = new URL(req.url) as URL;
|
||||||
url.pathname = url.pathname.replace(/\/+/g, "/");
|
url.pathname = url.pathname.replace(/\/+/g, "/");
|
||||||
|
|
||||||
|
|
@ -186,6 +190,14 @@ 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) {
|
error(error) {
|
||||||
console.error(`[ERROR] Server error:`, error);
|
console.error(`[ERROR] Server error:`, error);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue