Better Auth

BA

Better Auth

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

Join

bug-reports

help

Failed to initialize database adapter

I'm currently running the Drizzle adapter, and currently cannot get it to generate a schema. The following auth.ts causes the cli to throw: Failed to initalize database adapter ```ts...

Signin throws an occasional not valid JSON error

Hey everyone, I have a signin server action which simply lets user signin , but sometimes it throws a 500 error saying "<", "!DOCTYPE" ... is not valid JSON, I dont know what might cause this, also it can be the (Turso) database error, but am not sure, Why does it throw error occasionally or only at certain times? sometimes its quite frequent and gives very bad UX. This is my signin code : `signin: async ({ request, cookies }) => { let form = await request.formData(); let email = form.get('email') as string;...
No description

EDE in API endpoint set-active

API endpoint to set active org -> Is showing alot of information ```{ "id": "RbK9SjPZKhd-laZiqO_dS", "name": "xxxxx", "slug": "xxx",...

MongoDB

Fresh install nextjs following docs - And using the following for mongodb auth.ts ```import { betterAuth } from "better-auth"; import { mongodbAdapter } from "better-auth/adapters/mongodb"; import { client } from "@/db/index"; // Importing specifically from index...

basePath does not work in Next.js

I move files form src/app/api/auth/[..all] to src/app/api/v1/auth/[..all] and I add basePath to betterAuth -> basePath: "/api/v1/auth" export const auth = betterAuth({...

DeprecationWarning: The `punycode` module is deprecated

When I create a new user, the terminal gives me this message: DeprecationWarning: The Punycode module is deprecated. Please use a userland alternative instead. I use Next.js v15 - Node.js v22...
No description

Server auth not working (SvelteKit) via signin with email

Hey everyone, When I try to sign in with email and with server actions, the session doesnt seem to set or authentication simply doesnt complete In this code: `try { let res = await auth.api.signInEmail({ body: {...

Github Oauth not working in production

Hey everyone, I have a web app built with SvelteKit, for oauth with github everything works well and as expected in development environment or for localhost app, but things break and in console a 500 (Internal Server Error) logs out, am really not sure why is this happening, I have just followed the instructions from docs as it is, Help would be really appreciated. I don't know if it requires reproduction, cause there's nothing different going on from the docs steps, its just things dont work in production (Also, I deploy on cloudflare pages.)...

Prisma Adapter not generating models

The prisma adapter with any database, is not generating any models except the user, session, account and verifcation. I have the same auth client as I had in V0.6.0 I have all the plugins configured as expected. ...

JWT Not Working

When using this endpoint http://localhost:3000/v1/auth/jwks it returns an error ```typescript Cannot read properties of undefined (reading 'findMany') Better Auth ...

V0.7.0 Not Working

I am getting a huge error on V0.7.0-Beta...I changed nothing on the setup I had on V0.6 This is what the error looks like...
No description

Failed to get source map when using auth.api.getSession() during first request

Hey there 👋, I am having an issue getting my session on the server in a single request. Currently, it seems that two requests are being made for session data, and as for a brief moment, components accessing session data using useSession() render improperly. Has anyone had this issue before? Where can I begin to debug? ```GET /api/auth/session 401 in 78ms...

[Not sure if bug] Admin plugin does not use the Infering Types

As title says Using the create user ```const newUser = await authClient.admin.createUser({ name: "Test User",...

Incorrect Fields on Client Side

I am using Express as my backend and on the server the fields for user table is updated for example name is full_name in my database but when i use client side for login for example, the field name is still name instead of full_name

Error with Immutable Headers in Better Auth Session Middleware on Deno Server

Guys Hello , I’m working on setting up session management using Better Auth with a Deno server and Hono as the framework. I followed the documentation to create a middleware for session handling, but I'm running into an issue when trying to retrieve sessions....
No description

document outdated

it should be expirationTime
No description

Session Table ipAddress

I noticed in the session table theres an ipAddress column but when users logs in, it will not capture user IP Address. I am using Angular as Frontend and Express with Typescript for my server

API calls returns Unauthorized

I have better auth setup on https://accounts.domain.com in production, for testing purposes When I hit /api/auth/get-session on another app, running in localhost, I get 401 unauthorized. I also have the multi domain setup like this ...

Client Side Not Working

I am trying to login using better-auth on client side but i get this error message: "Invalid currentURL and this is the endpoint for my api http://localhost:3000/api/auth/sign-in/email?currentURL=http%3A%2F%2Flocalhost%3A8100%2Fhome

Error in NodeJS

I get this error on the latest version of better auth ```cli node:internal/modules/esm/resolve:296 return new ERR_PACKAGE_PATH_NOT_EXPORTED(...