The model "oauthResource" was not found in the schema object
Author: AdamJSoftwareCreated Sep 15, 2026Updated Sep 15, 2026
Is this suited for github?
- Yes, this is suited for github
Reproduction
Better auth 1.7.5 with drizzle adapter.
? The file ./auth-schema.ts already exists. Do you want to overwrite the schema to the file? › (y/N)node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
[BetterAuthError: [# Drizzle Adapter]: The model "oauthResource" was not found in the schema object. Please pass the schema directly to the adapter options.]
Node.js v24.12.0(sometimes I get this error too if I use v2-relations or I do some kind of switch up. It is hard to track)
[#better-auth]: Couldn't read your auth config. TypeError: (0 , _drizzleOrm.defineRelationsPart) is not a function
at /Users/adam/Documents/databending/mediapp-client/auth-schema.ts:360:83
at async import (/Users/adam/.npm/_npx/cec068fea869db4d/node_modules/jiti/dist/jiti.cjs:1:187718)
at async /Users/adam/Documents/databending/mediapp-client/src/lib/schema.ts:1:190
at async import (/Users/adam/.npm/_npx/cec068fea869db4d/node_modules/jiti/dist/jiti.cjs:1:187718)
at async /Users/adam/Documents/databending/mediapp-client/src/lib/auth.ts:13:38
at async Function.import (/Users/adam/.npm/_npx/cec068fea869db4d/node_modules/jiti/dist/jiti.cjs:1:187718)
at async file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/c12/dist/index.mjs:350:27
at async resolveConfig (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/c12/dist/index.mjs:339:17)
at async loadConfig (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/c12/dist/index.mjs:156:22)
at async load (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/auth/dist/index.mjs:1209:11)
at async getConfig (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/auth/dist/index.mjs:1234:17)
at async Command.generateAction (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/auth/dist/index.mjs:2337:17)
at async Command.parseAsync (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/commander/lib/command.js:1113:5)
at async main (file:///Users/adam/.npm/_npx/cec068fea869db4d/node_modules/auth/dist/index.mjs:7782:2)This seems to only happen with the MCP plugin. I have tried with the regular oauth-proivder plugin and it works just fine.
mcp({
loginPage: "/sign-in", // path to your login page
consentPage: "/consent", // path to your consent page
resource: "https://api.example.com/mcp", // protected resource identifier
}),
cimd({
fetchClientMetadataResource,
metadataProfile: "mcp-2026-07-28",
}),
Current vs. Expected behavior
For npx auth@latest generate to generate the actual schema. Now it just breaks/crashes
What version of Better Auth are you using?
1.7.5
System info
MacOSWhich area(s) are affected? (Select all that apply)
Backend
Auth config (if applicable)
import { betterAuth } from "better-auth"
export const auth = betterAuth({
emailAndPassword: {
enabled: true
},
});Additional context
No response
Source: better-auth/better-auth