Better Auth

BA

Better Auth

Join the community to ask questions about Better Auth and get answers from other members.

Join

bug-reports

help

Error Generating Types with openapi-typescript

Issue Description: Running the command bunx openapi-typescript --make-paths-enum --immutable results in the following error:
Error: #/paths/~1sign-in~1social/post/responses/200/content/application~1json: invalid property required. Expected Schema Object, got Array
Error: #/paths/~1sign-in~1social/post/responses/200/content/application~1json: invalid property required. Expected Schema Object, got Array
...
No description

Cannot cancel a trailing subscription

I'm trying to cancel a trialing subscription, by passing the subscription id in cancel function, but I receive a 400 response saying that the subscription cannot be found, but when I check my DB it is definitely there and the subscription Id matches. Am I supposed to cancel trials differently than active subscriptions?

Session schema missing from open API spec generation

I'm using the following code to generate open API documentation, however I noticed the reference to #/components/schemas/Session is missing? auth.api.generateOpenAPISchema()...

[Better Auth]: Error 4816

I am using simple setup for better-auth trying it with Bun.serve. const server = Bun.serve({ fetch: auth.handler, port: 3000,...

stripe subscription event hooks

1. None of the Stripe Subscription Event Hooks are being triggered. 2. No Error Message 3. See attached image the onEvent hook does work... if I implement them myself and in the future better-auth hooks start working there is going to be pain when double spends happen etc....
No description

Stripe plugin - upgrade() creates two subscriptions instead of updating existing one.

I have two plans, "Starter" and "Pro". If a user upgrades their plan from "Starter" to "Pro" with the upgrade() method, there becomes two active subscriptions at the same time in Stripe (see image attached). This will bill the user for both plans, which isn't correct.
No description

`drizzleAdapter` is not handling `ne` operator

Hello, currently the convertWhereClause (L133) in drizzleAdapter is not handling the ne operator and fallsback to eq by default. Version: 1.2.7 This cause invalid data being returned on filters. See below example:...

Empty headers in verifyPhoneNumber API

I am receiving empty headers when I'm expecting it to to have better-auth.session_token set-cookie
No description

Stripe plugin create a new customer on subscription.upgrade click.

I have 2 different buttons to subscription.upgrade in my app. After user is registered customer is created in stripe according to createCustomerOnSignUp: true, in plugin config. But when I navigate to one of my 'Subscribe' buttons and click on it -> subscription.upgrade just creates new user in stripe instead of triggering checkout session: ```sh 2025-04-20 14:38:59 --> customer.created [evt_1RG3hf4FS9Rcg327BHPwlIez] 2025-04-20 14:38:59 <-- [200] POST http://localhost:3000/api/auth/stripe/webhook [evt_1RG3hf4FS9Rcg327BHPwlIez]...

change email does not update the customer's email in stripe

When executing an email change, the new email is not updated in the stripe's customer table in the dashboard. Is that something that is meant to be done manually? I would have expected BA to check if there is a customer Id set on that user and if so, trigger the change in stripe as well. Question is just, should it happen right after the change requested got accepted by the user (from the sendChangeEmailVerification email) or after the new email got verified. That could maybe depend on the `re...
Solution:
Hey are you able to open a github issue on this? In the mean time you can hse hooks to manually update users...

Period fields not populated after stripe subscription

Hello, period_start and period_end fields in the subscription object are not populated after a user subscribes via subscription.upgrade. Stripe : 17.7.0 Better-auth : 1.2.7...
Solution:
Good in v1.2.8-beta.3 : Solved

Website is not available

The Better‑auth.com website is currently inaccessible in the UAE. I’ve tested it with several internet service providers: it was reachable as recently as last week, but for the past few days it has been returning a persistent DNS error.
No description

Starting v1.2.6 `database.generateId = false` still inserts Id into the verification table

On v1.2.6 onward (was working in v1.2.5), when setting database.generateId = false Id is still being generated for the verification table. I'm using pg with kysely-postgres-js ```js...

NextJS trailing slash ignored

Per title, if I set trailingSlash: true in my next config, I would expect better-auth to respect those same rules, as currently every request just hits a redirect as better-auth is querying URL's without a trailing slash

Doesn't always respect NextJS basepath

For example, if I set a basePath of '/test', after successfuly logging in I'll be redirected to simply '/', rather than '/'

member.createdAt has wrong timezone

When new members join an org, the membership.createdAt date is 2h into the future because of some timezone conversion error. In the attached images I joined an organization at 14:12 local time (12:12 UTC, which is what the DB stores), but the date that reaches the client is 14:12 UTC.
No description

Email Verification required and Captcha return the same error code

Hey! 👋 I think this might be a bug — or at least a DX issue — because the current implementation doesn’t let us differentiate between different failure cases. Here’s the relevant code: ...

Passkeys & verification Model, expiresAt always in past

With 1.2.7 I do not get passkeys login working anymore. In the database verification table I see expiresAt always have the same timestamp for each passkey createVerificationValue request (2025-04-16 10:07:45.958). This is in the past and I think this is the cause the browser do not start the webauthn process. Looks like at starting next.js server it's resulting into static timestamp of that moment. It does not recalculate the expirationTime for each createVerificationValue request. In code I found: ``` const expirationTime = new Date(Date.now() + 1e3 * 60 * 5);...

Session Not Updating & Expired session continues to be active

Issue 1 : Session Cookie, nor session expiration is being updated issue 2: Even After session is expired. Im getting valid session response (sending cookie manually) better-auth version 1.2.7 ...
Next