import { betterAuth } from "better-auth";
import { anonymous } from "better-auth/plugins";
import { Kysely } from "kysely";
import { D1Dialect } from "kysely-d1";
// Can't get a reference of D1 from here since it's outside the incoming request scope
export const auth = betterAuth({
database: {
db: new Kysely({
dialect: new D1Dialect({
database: process.env.DB as unknown as D1Database, // this results in database: undefined
}),
}),
type: "sqlite",
},
emailAndPassword: {
enabled: true,
},
plugins: [anonymous()],
});
import { betterAuth } from "better-auth";
import { anonymous } from "better-auth/plugins";
import { Kysely } from "kysely";
import { D1Dialect } from "kysely-d1";
// Can't get a reference of D1 from here since it's outside the incoming request scope
export const auth = betterAuth({
database: {
db: new Kysely({
dialect: new D1Dialect({
database: process.env.DB as unknown as D1Database, // this results in database: undefined
}),
}),
type: "sqlite",
},
emailAndPassword: {
enabled: true,
},
plugins: [anonymous()],
});