BA
Better Auth•4mo ago
Aruthoth

Stripe plugin does not create subscription schema via CLI

Hello, after running npx @better-auth/cli generate, I noticed that the generated schema does not contain the subscription table. I also observed that the stripeCustomerId field in the users table was created correctly. "better-auth": "^1.2.8" "@better-auth/stripe": "^1.2.8" "stripe": "^18.0.0" I configured the Stripe plugin as follows:
import { stripe } from '@better-auth/stripe'
import { betterAuth } from 'better-auth'
import { drizzleAdapter, type DB } from 'better-auth/adapters/drizzle'
import { openAPI, organization } from 'better-auth/plugins'
import Stripe from 'stripe'

export const auth = betterAuth({
database: drizzleAdapter({} as DB, {
provider: 'sqlite',
usePlural: true,
}),
emailAndPassword: {
enabled: true,
},
user: {
additionalFields: {
role: {
type: 'string',
required: false,
defaultValue: 'user',
input: false,
},
},
},
plugins: [
openAPI(),
organization({
// --- Core Organization Settings ---
creatorRole: 'owner',
teams: {
enabled: true,
},
}),
stripe({
stripeClient: new Stripe(
'KEY',
{
apiVersion: '2025-05-28.basil',
},
),
stripeWebhookSecret: 'KEY',
createCustomerOnSignUp: true,
}),
],
})
import { stripe } from '@better-auth/stripe'
import { betterAuth } from 'better-auth'
import { drizzleAdapter, type DB } from 'better-auth/adapters/drizzle'
import { openAPI, organization } from 'better-auth/plugins'
import Stripe from 'stripe'

export const auth = betterAuth({
database: drizzleAdapter({} as DB, {
provider: 'sqlite',
usePlural: true,
}),
emailAndPassword: {
enabled: true,
},
user: {
additionalFields: {
role: {
type: 'string',
required: false,
defaultValue: 'user',
input: false,
},
},
},
plugins: [
openAPI(),
organization({
// --- Core Organization Settings ---
creatorRole: 'owner',
teams: {
enabled: true,
},
}),
stripe({
stripeClient: new Stripe(
'KEY',
{
apiVersion: '2025-05-28.basil',
},
),
stripeWebhookSecret: 'KEY',
createCustomerOnSignUp: true,
}),
],
})
2 Replies
Ping
Ping•4mo ago
Okay this is very odd. Haven't seen this issue before. @Aruthoth Can you test trying to regenerate again and seeing if it makes any difference? If not, try adding apiKey plugin and seeing how that goes. Need to do some testing to find out why it would randomly skip 1 table 🤔
Aruthoth
AruthothOP•4mo ago
If I leave the string empty '' for STRIPE_SECRET_KEY, I get this error: [Better Auth]: [#better-auth]: Couldn't read your auth config. Error: Neither apiKey nor config.authenticator provide. If I enter a valid key, the result is a schema without the subscription table. However, I tested configuring a static plan, and it worked—the table was generated. Apparently, I need to configure plans for the table to be created, since the typing doesn’t allow simply doing subscription: { enable: true }. Based on the documentation, I assumed the table would be generated even without providing a plan. My workflow was first to implement the integration with Stripe and then later add what Stripe handles, like plans. Maybe a note about this could help avoid this little confusion in the future 😅

Did you find this page helpful?