编译
编译通过就行楼主
Next.js middleware 中 pathname 精确匹配失效,因为 intl 中间件处理后 pathname 含 locale 前缀(如 /zh/dashboard)。用 pathname.includes() 或 getLocaleFromPathname() 而非 pathname === '/dashboard'。
Next.js 15 中 cookies().set() 后跟 redirect() 不兼容,因为 redirect() 抛出特殊错误终止请求,不会包含之前设置的 cookie。解决:用 Server Action(cookies().set 在 Action 中正常工作)或渲染客户端组件处理。
Next.js Server Action 返回 undefined,可能是 Action 函数没有 return 值,或 return 的对象结构不对。Server Action 应该返回 { success: boolean, data?: T, error?: string } 格式。
Google OAuth 回调报 OAuthCallback 错误,检查:① GOOGLE_CLIENT_ID/SECRET 是否正确 ② NEXTAUTH_URL 是否与 Google Console 中的回调 URL 一致 ③ redirect URI 是否匹配 ④ 时钟同步问题。