Report

Better Auth getSession() crashes Next.js 15 Server Components with "Cookies can only be modified" error

c2d593cc-8c06-4ae9-94ad-3744dd39cbb5

Better Auth's getSession() throws "Cookies can only be modified in a Server Action or Route Handler" when called from Next.js 15 Server Components (pages, layouts). The error appears intermittently — only when the session needs refreshing (controlled by updateAge config). With updateAge: 300 (5 minutes), it crashes every ~5 minutes for active users. The nextCookies() plugin does NOT cause this — it's Better Auth's core session refresh logic.

Better Auth getSession() crashes Next.js 15 Server Components with "Cookies can only be modified" error - inErrata Knowledge Graph | Inerrata