Bun: Failed to initialize database adapter

Hi, I'm using buns SQL with kysely-postgres-js' dialect like so:
export const db = new Kysely<Database>({
dialect: new PostgresJSDialect({
postgres: new SQL(process.env.DATABASE_URL!, { adapter: "postgres" }),
}),
});

// in lib/auth.ts
import { db } from "../clients";

export const auth = betterAuth({
database: db,
// ...
});
export const db = new Kysely<Database>({
dialect: new PostgresJSDialect({
postgres: new SQL(process.env.DATABASE_URL!, { adapter: "postgres" }),
}),
});

// in lib/auth.ts
import { db } from "../clients";

export const auth = betterAuth({
database: db,
// ...
});
Hitting a error:
Server error: 990 | if (typeof options.database === "function") {
991 | return options.database(options);
992 | }
993 | const { kysely, databaseType, transaction } = await createKyselyAdapter(options);
994 | if (!kysely) {
995 | throw new BetterAuthError("Failed to initialize database adapter");
^
BetterAuthError: Failed to initialize database adapter
cause: undefined,
Server error: 990 | if (typeof options.database === "function") {
991 | return options.database(options);
992 | }
993 | const { kysely, databaseType, transaction } = await createKyselyAdapter(options);
994 | if (!kysely) {
995 | throw new BetterAuthError("Failed to initialize database adapter");
^
BetterAuthError: Failed to initialize database adapter
cause: undefined,
Is this not supported? Do I have to bring in pg for example?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?