Trying to connect kysely-neon with Better Auth but failed.

I don't know what causes this, but apparently coming from the configuration.
I already created my src/lib/auth.ts file inside my SvelteKit project.
And this is my code:
import { betterAuth } from "better-auth";
import { Kysely } from "kysely";
import { NeonHTTPDialect } from "kysely-neon";
import { env } from "$env/dynamic/private";

const db = new Kysely({
    dialect: new NeonHTTPDialect({
        connectionString: env.DATABASE_URL
    })
})

export const auth = betterAuth({
    database: db
});


However when I tried to run
npx @better-auth/cli
, it output me this error:
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

[BetterAuthError: Failed to initialize database adapter] {
  cause: undefined
}

Node.js v22.18.0


Now I'm stuck 🙁
Was this page helpful?