Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix: log actual error and add sync pino.destination fallback (#165)
diegosouzapw68b7b354256a
diff --git a/src/shared/utils/logger.ts b/src/shared/utils/logger.tsindex 7df7bfcfa1..f47f527c75 100644--- a/src/shared/utils/logger.ts+++ b/src/shared/utils/logger.ts@@ -92,9 +92,33 @@ function buildLogger(): pino.Logger {],},});- } catch {- // If file setup fails, fall back to console-only logging- console.warn("[logger] Failed to set up file transport, falling back to console only");+ } catch (err) {+ // Log the actual error for diagnostics (issue #165)+ console.warn(+ "[logger] Failed to set up file transport, attempting sync fallback...",+ (err as Error)?.message || err+ );++ // Fallback: use sync pino.destination() instead of worker-thread transport+ // pino.transport() uses worker threads which can fail in Next.js production bundles+ try {+ const absLogPath = resolve(logConfig.logFilePath);+ const fileDestination = pino.destination({ dest: absLogPath, mkdir: true, sync: true });++ // Production fallback: JSON to both stdout and file via multistream+ return pino(+ baseConfig,+ pino.multistream([+ { stream: process.stdout, level: logLevel as pino.Level },+ { stream: fileDestination, level: logLevel as pino.Level },+ ])+ );+ } catch (fallbackErr) {+ console.warn(+ "[logger] Sync fallback also failed, falling back to console only",+ (fallbackErr as Error)?.message || fallbackErr+ );+ }}}