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:
export const auth = betterAuth({
adapter: {
type: "postgres",
url: process.env.DATABASE_URL, // I also tried databaseUrl
},
secret: process.env.BETTER_AUTH_SECRET,
plugins: [
oidcProvider({
loginPage: "/login",
// ...
})
]
});
export const auth = betterAuth({
adapter: {
type: "postgres",
url: process.env.DATABASE_URL, // I also tried databaseUrl
},
secret: process.env.BETTER_AUTH_SECRET,
plugins: [
oidcProvider({
loginPage: "/login",
// ...
})
]
});
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
Vlad
Vlad2mo ago
You need to provide an adapter If you don't use an ORM library, use this one
Vlad
Vlad2mo ago
Also the adapter field doesn't exist in the better-auth config lol
Rooting
RootingOP2mo ago
ok i see i do that normally its good
No description
Vlad
Vlad2mo ago
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.

Did you find this page helpful?