Isaac Fimbres
BABetter Auth
•Created by Isaac Fimbres on 3/5/2025 in #help
Infinite Call Using Organizations
Hey there, so I'm trying to get this to work, but when I open my app it keeps fetching the following endpoint on and on.
GET /api/auth/organization/list 200 in 45ms
I'm using it like this:
const authClient = createAuthClient({
baseURL: getBaseUrl(),
plugins: [
organizationClient({
teams: {
enabled: true
}
}),
]
});
const { data } = authClient.useListOrganizations();
console.log(data)
this is my auth.ts file
import { betterAuth } from "better-auth";
import { nextCookies } from "better-auth/next-js";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { organization } from "better-auth/plugins"
import { db } from "@ideate/server/db";
export const auth = betterAuth({
plugins: [
organization({
teams: {
enabled: true,
maximumTeams: 10,
allowRemovingAllTeams: true,
}
}),
nextCookies()
],
database: drizzleAdapter(db, {
provider: "pg",
}),
});
Am I missing something?
5 replies
BABetter Auth
•Created by Isaac Fimbres on 2/26/2025 in #help
ERR_INVALID_ARG_TYPE
Hey, so suddenly my app auth just stopped working. if I go to a protected route I got redirected to the landing page, and if I try to login or signup I always get the same error now:
ERROR [Better Auth]: Failed to create user TypeError: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date
at Array.forEach (<anonymous>) {
code: 'ERR_INVALID_ARG_TYPE'
}
I tried to change to my main branch, but it's still having the same behavior.
Auth.js:
import { betterAuth } from "better-auth";
import { nextCookies } from "better-auth/next-js";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "@ideate/server/db";
export const auth = betterAuth({
plugins: [nextCookies()],
database: drizzleAdapter(db, {
provider: "pg",
}),
emailAndPassword: {
enabled: true,
autoSignIn: true,
},
});
db schema (attached)
5 replies