No response from API in Next.js

I’m having trouble with the API:

I added the OpenAPI plugin and tried calling the API, for example via /api/auth/reference, but I don’t get any response. The same issue occurs when I try to register a user. The requests keep loading for a long time until I eventually get an Internal Server Error.

Someone else seems to have the same problem: https://github.com/better-auth/better-auth/issues/1394

route.ts in api/auth/[...all]
import { auth } from "@/lib/auth";
import { toNextJsHandler } from "better-auth/next-js";

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


auth.ts
import {betterAuth} from "better-auth";
import {drizzleAdapter} from "better-auth/adapters/drizzle";
import {database} from "@/database";
import {openAPI} from "better-auth/plugins";

export const auth = betterAuth({
    database: drizzleAdapter(database, {
        provider: 'mysql',
    }),
    plugins: [
        openAPI()
    ],
    emailAndPassword: {
        enabled: true,
    },
})


Has anyone ever had this problem and already has a solution?
GitHub
Is this suited for github? Yes, this is suited for github To Reproduce Develop a NestJS backend and integrate it with BetterAuth. Set up BetterAuth in Next.js according to the documentation and con...
Was this page helpful?