return betterAuth({
secret: process.env.BETTER_AUTH_SECRET,
logger: console,
trustedOrigins: [getServerUrl(), '*'],
onAPIError: {
throw: true,
onError(e, context) {
console.error("[BETTER_AUTH - ERROR]", e);
console.error("[BETTER_AUTH - CONTEXT]", context);
}
},
baseURL: getServerUrl(),
// This works in my local just fine
database: drizzleAdapter(getDrizzleDb(), {
provider: "pg",
usePlural: false,
schema: {
...DbSchema,
user: DbSchema.user,
},
}),
plugins: [
nextCookies(),
magicLink({
sendMagicLink: async ({ email, token, url }) =>
// Send email function
}),
return betterAuth({
secret: process.env.BETTER_AUTH_SECRET,
logger: console,
trustedOrigins: [getServerUrl(), '*'],
onAPIError: {
throw: true,
onError(e, context) {
console.error("[BETTER_AUTH - ERROR]", e);
console.error("[BETTER_AUTH - CONTEXT]", context);
}
},
baseURL: getServerUrl(),
// This works in my local just fine
database: drizzleAdapter(getDrizzleDb(), {
provider: "pg",
usePlural: false,
schema: {
...DbSchema,
user: DbSchema.user,
},
}),
plugins: [
nextCookies(),
magicLink({
sendMagicLink: async ({ email, token, url }) =>
// Send email function
}),