15 lines
550 B
TypeScript
15 lines
550 B
TypeScript
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);
|
||
}
|
||
}
|