This commit is contained in:
Vaica committed 2026-06-24 13:52:16 +08:00
1 parent f9076df6e8
commit 500e1a5a42
2 files changed
+119 -4

No files matched your search

+10 -4
View File
@@ -1,8 +1,14 @@
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
// 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");
startBot().catch((e) => {
console.error("[instrumentation] bot startup failed:", e);
});
console.log("[instrumentation] starting bot...");
await startBot();
console.log("[instrumentation] bot started successfully");
} catch (e) {
console.error("[instrumentation] bot startup failed:", e);
}
}