OIDC Provider: "No database configuration provided" and plugin not loaded on Vercel
Hi!
I’m trying to use the OIDC Provider plugin with Better Auth on a Next.js (App Router) project deployed on Vercel.
My DATABASE_URL and BETTER_AUTH_SECRET environment variables are correctly set (I can see them in my logs).
My lib/auth.ts config looks like this:
On every request, I get this warning:
[Better Auth]: No database configuration provided. Using memory adapter in development
And when I hit /oauth2/authorize, I get a 500 error:
TypeError: Cannot read properties of undefined (reading '0')
My DATABASE_URL is a NeonDB connection string
I’ve tried:
Both url and databaseUrl in the adapter config
Forcing a password in the connection string
Running locally and on Vercel (same issue)
Updating to the latest version of better-auth
Is there something I’m missing in the configuration?
Is the Postgres adapter (with NeonDB) supported on Vercel?
Any advice to get the OIDC plugin working with a real database?
Thanks a lot for your help!
6 Replies
You need to provide an adapter
If you don't use an ORM library, use this one
PostgreSQL | Better Auth
Integrate Better Auth with PostgreSQL.
Also the
adapter
field doesn't exist in the better-auth config lolok i see i do that normally its good

but for exemple : https://AUTHdomain/oauth2/authorize?client_id=cyberctf&scope=openid%20email%20profile&response_type=code&redirect_uri=https%3A%2F%2Fcyber-ctf-website-git-test.vercel.app%2Fapi%2Fauth%2Fcallback%2Fbetter-auth&state=NOYB8iARnDGiOOPgVNuXXge6zzZ2IiIZylL6Jf1-UkI
I GET :
{"error":"OIDC authorize handler not implemented in plugin."}
I don't really know what the issue is as I haven't used this plugin. Keep in mind the plugin may not be suitable for production use and make sure you follow all steps https://www.better-auth.com/docs/plugins/oidc-provider
OIDC Provider | Better Auth
Open ID Connect plugin for Better Auth that allows you to have your own OIDC provider.