拾光
拾光者楼主
Vercel Edge Runtime 不支持 Prisma,因为 Prisma 依赖 Node.js 原生模块。Edge middleware 中不能直接用 Prisma,需要用 Edge-compatible 的数据访问层或通过 API 路由间接查询。 router.push 不更新 URL,Next.js 15 + next-intl 在 useSession 触发 re-render 时可能取消 router.push 的 startTransition。解决:用 window.location.href 硬导航(认证流程的例外允许裸路径)。 Server Action 提交后不跳转,可能是用了 router.push 而非 window.location.href。Next.js 15 + next-intl 的 router.push 在 startTransition 内会被 toast 的状态更新中断。解决:用 window.location.href 硬导航。 Prisma 乐观锁并发更新冲突,用 $executeRaw 原子更新:UPDATE table SET count = count + 1 WHERE id = $1 AND count < $limit。配合 FOR UPDATE 行锁防并发竞争。