Fix: Use toNextJsHandler from better-auth for Next.js 16 route handler

The auth endpoint was returning 404 because the route handler wasn't
properly using better-auth's Next.js integration. Use toNextJsHandler()
to properly export the handlers.
This commit is contained in:
bananabas 2026-04-13 19:14:39 +01:00
parent 67f24f4cd7
commit 094853c9da
2 changed files with 2 additions and 7 deletions

View file

@ -1,9 +1,4 @@
import { auth } from '@/lib/auth';
import { toNextJsHandler } from 'better-auth/next-js';
const handler = auth.handler;
export const GET = handler;
export const POST = handler;
export const PATCH = handler;
export const PUT = handler;
export const DELETE = handler;
export const { GET, POST, PUT, PATCH, DELETE } = toNextJsHandler(auth);