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:
2 Replies
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 🤔
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 😅