Better Auth Signup Failing with "Failed to create account" on Next.js 16 + Neon Postgres

Hi everyone,
I am experiencing an issue where users are unable to register on my production website .
When a user tries to sign up using their email and password, the registration fails on the client side with the error: Failed to create account.

what i have tried checked :
1-Added BETTER_AUTH_URL: Confirmed that BETTER_AUTH_URL is set to my website on Vercel and redeployed.
2-Database Connectivity: The Neon Postgres connection string is configured and accessible, but I suspect that the database might be missing the required tables (user, session, account, etc.) because I haven’t run any schema push or migrations yet.

Questions:
Is there a specific way I should run database migrations or table generation when using a direct pg pool with Better Auth on Neon?
Does npx better-auth migrate work directly with the Neon serverless driver or do I need Drizzle-Kit / Prisma to create the tables?
What is the best way to debug the exact server-side error logs on Vercel to see why the API is failing?
Any help or guidance would be greatly appreciated! Thank you!ation, and steps that reproduce this issue →

Hi Musab,

Yes, if the Better Auth tables have not been created yet, that is the first thing I’d fix. A client-side Failed to create account often just means the server route returned a generic error, while the real issue is in the Vercel runtime logs.

For Better Auth, the migration path depends on the adapter you are using:

Built-in PostgreSQL/Kysely adapter:
npx auth@latest migrate

Drizzle adapter:
npx auth@latest generate
npx drizzle-kit generate
npx drizzle-kit migrate

or, during early development only, you can use:

npx drizzle-kit push

I would run the migration from your local terminal or CI with the same Neon DATABASE_URL that production uses. Do not try to create the tables from inside the signup request.

After that, check Neon directly and confirm the auth tables exist, usually things like:

user
session
account
verification

For debugging on Vercel, open:

Project → Logs

Then reproduce one signup attempt and filter for the auth route, likely something like:

/api/auth/sign-up/email
/api/auth/*

If you add temporary logging, only log safe details:

console.error("signup failed", {
  message: error instanceof Error ? error.message : String(error),
})

Do not log the database URL, Better Auth secret, password, session token, or request body.

I’d also double-check these production env vars and redeploy after changing them:

BETTER_AUTH_URL=https://your-production-domain.com
BETTER_AUTH_SECRET=...
DATABASE_URL=...

Better Auth’s database docs explain the migrate vs generate distinction here:

If the tables exist and signup still fails, the next useful detail is the server-side error from Vercel Logs with secrets removed.