Files
blog/write-server/src/instrumentation.ts
T

14 lines
550 B
TypeScript
Raw Normal View History

2026-06-21 20:42:44 +08:00
export async function register() {
2026-06-24 13:52:16 +08:00
// Next.js instrumentation hook - 在服务器启动时执行
console.log("[instrumentation] register() called, NEXT_RUNTIME:", process.env.NEXT_RUNTIME);
// 只在 Node.js 环境运行(Docker 部署,非 Edge Runtime)
try {
2026-06-21 20:42:44 +08:00
const { startBot } = await import("@/lib/bot");
2026-06-24 13:52:16 +08:00
console.log("[instrumentation] starting bot...");
await startBot();
console.log("[instrumentation] bot started successfully");
} catch (e) {
console.error("[instrumentation] bot startup failed:", e);
2026-06-21 20:42:44 +08:00
}
}