1352
This commit is contained in:
1 parent
f9076df6e8
commit
500e1a5a42
2 files changed
+119
-4
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user