Next.js Discord

Discord Forum

Can't get build to succeed Type error: Route "app/api/auth/[...all]/route.ts" has an invalid export

Unanswered
American Fuzzy Lop posted this in #help-forum
Open in Discord
American Fuzzy LopOP
This may be a better-auth issue, but I am in a critical time crunch and need to get something working so looking for any help possible. When running pnpm build I am getting this:
app/api/auth/[...all]/route.ts
Type error: Route "app/api/auth/[...all]/route.ts" has an invalid export:
  "unknown" is not a valid GET return type:
    Expected "void | Response | Promise<void | Response>", got "unknown".

Next.js build worker exited with code: 1 and signal: null

The route is:
import { auth } from "@/lib/auth";
import { toNextJsHandler } from "better-auth/next-js";

export const { GET, POST } = toNextJsHandler(auth.handler);

0 Replies