Files
blog/write-server/src/instrumentation.ts
T
2026-06-24 13:52:16 +08:00

15 lines
550 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export async function register() {
// Next.js instrumentation hook - 在服务器启动时执行
console.log("[instrumentation] register() called, NEXT_RUNTIME:", process.env.NEXT_RUNTIME);
// 只在 Node.js 环境运行(Docker 部署,非 Edge Runtime)
try {
const { startBot } = await import("@/lib/bot");
console.log("[instrumentation] starting bot...");
await startBot();
console.log("[instrumentation] bot started successfully");
} catch (e) {
console.error("[instrumentation] bot startup failed:", e);
}
}