Better Auth

BA

Better Auth

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

Join

bug-reports

help

Network error!

Sometimes, my users report encountering a sudden "Network error." The issue occurs unexpectedly, but when they sign in from another device, it works fine, and the error resolves on its own after some time. What could be the root cause of this issue, and how can I effectively fix it? CC @bekacru...

if verification.disableCleanup set true, then the records were getting deleted in verification table

I have set the verification.disableCleanup as true, still the records in verification table are getting deleted

NextJS build error

Hello, I'm trying to run the NextJS project build with better-auth but I'm getting the error. Could someone help me? ```Failed to compile. ./node_modules/better-auth/dist/client/react/index.mjs...
No description

Double Owner member ship creation on creation of organization

I have upgraded to v1.2 but am having issue where when you create an organization the member ship get created twice and i even inspected if am making double request but not yet and i don't have double middleware and this is the block of code am using creating organization ```ts await authClient.organization.create({ name: data.name,...
No description

TypeError: Cannot read properties of undefined (reading 'value') at withReturning

this is a fun error
TypeError: Cannot read properties of undefined (reading 'value')
at withReturning (/Users/omar/code/1up/node_modules/better-auth/dist/adapters/drizzle-adapter/index.cjs:169:38)
TypeError: Cannot read properties of undefined (reading 'value')
at withReturning (/Users/omar/code/1up/node_modules/better-auth/dist/adapters/drizzle-adapter/index.cjs:169:38)
...

Error: invalid column data type undefined - when running generate migration

Error running the cli generate. In addition to diagnosing, I think the error logging should be clearer here. What column? better-auth 1.2.4 ``` % npx @better-auth/cli@latest generate...

pnpx @better-auth/cli generate removing session table

I am doing something wrong, as the cli generate with drizzle adapter automatically removes the session table on each run?

Drizzle adapter usePlural not working with passkey & JWT plugins

I'm having an issue with usePlural for Drizzle where passkey is being entered as passkey but jwks is being entered as jwkss. For passkey, I got it to properly generate the correct plural but I had to add the following to plugins: ```ts passkey({...

getSessionCookie is broken in Next.js middleware

I have to manually check my cookies in middleware, which works just fine. But getSessionCookie never returns. ```ts import { type NextRequest, NextResponse } from "next/server" ...

The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit t

I upgraded my version from 1.12 to 1.21 and I started getting this error. I tried changing my ts config to account for bigger types but that doesn't seem to help
Solution:
this fixed it but this hasn't happened before

organization.update does not error on missing permissions

The role check seems to work because the updates are not actually committed but the response indicates success when it should instead error because of missing permissions. ``` const permissionResult = await authClient.organization.hasPermission({ permission: {...

Delete Verification value function

In state.ts in the better auth source code located at src/oauth2, in the parseState function if the verification value is expired, then it throws a "please_restart_the_process". but does not delete the verification value from the db as the delete verification db call is after the throw error statement which stops function execution. ``javascript if (parsedData.expiresAt < Date.now()) { throw c.redirect( ${c.context.baseURL}/error?error=please_restart_the_process`,...
Solution:
fixed in 1.2.4-beta.6

useSession not reactive?

The useSession hook from the authentication client is not updating reactively. After the initial render, the isPending state remains true indefinitely, even after authentication is complete. The component only refreshes its state when there's a code change that forces a re-render. const { data: session, isPending } = authClient.useSession(); Even after authentication is complete, the component doesn't update to show the user as logged in until the file is saved or another action triggers a re-render....

Polar plugin wrong css on mobile

Basically the layout is suddenly different at the Polar plugin on mobile (See photo) Should be a quick fix ^^...
No description

getSessionCookie() return null is some cases

its confusing for some of us that getSessionCookie() is not behaving like we expect for the next reasons: - the function is not respecting the auth options specified in auth.ts ```javascript advanced: { cookies: {...

Hydration error in useListOrganizations hook

Describe the bug The useListOrganizations hook is causing React hydration mismatches between server and client rendering. next-forge version...

Cookie cache does not refresh

When using the cookie cache, the session_data cookie is not refreshed if I read the session data on the server. It refreshes if I client side do const session = authClient.useSession(), but not if I read it on the server with const session = await authClient.api.getSession({ headers }) Is it not supposed to?...

API signUpEmail not throwing error

Hello there, I'm new here. I love working with better-auth, is been really great so far! Here is my problem: After upgrading from v1.1.20 to latest, running:...
Next