Skip to content

fix(better-auth): add account.issuer column for Better Auth 1.7 - #792

Closed
brillout wants to merge 2 commits into
mainfrom
claude/commit-author-vike-b23iof
Closed

brillout wants to merge 2 commits into
mainfrom
claude/commit-author-vike-b23iof

Conversation

@brillout

Copy link
Copy Markdown
Member

Problem

Every scaffolded better-auth app currently fails on sign-up:

ERROR [Better Auth]: D1_ERROR: table account has no column named issuer: SQLITE_ERROR
AssertionError: expected 500 to be 200   // e2e "auth: email/password flow"

Better Auth 1.7 (published 2026-08-18) scopes account identity by issuer and adds a required issuer column to the account table. Bati declares better-auth: ^1.6.26, so fresh installs resolve 1.7.x while the two schemas Bati maintains by hand are still on the 1.6 shape. It reached CI as dependency drift rather than through any commit — main's last green Tests run predates the 1.7.0 release.

Diffing Better Auth's own generated schema between 1.6.30 and 1.7.1 shows the delta is exactly the new column (plus a account_issuer_accountId_uidx index — see below):

-- 1.7.1
create table "account" ("id" text not null primary key, "issuer" text not null, "accountId" text not null, ...)

Changes

  • files/database/migrations/$better-auth.sql.ts — add "issuer" text NOT NULL to the wrangler D1 migration (Cloudflare D1 without an ORM).
  • files/database/drizzle/schema/auth.ts — add the column to the account table, both the pg and sqlite variants.
  • package.json ×4 — raise the better-auth floor to ^1.7.1 (the better-auth boilerplate plus the react/solid/vue client boilerplates, kept in lockstep). The shipped schema now requires 1.7: on 1.6 the new NOT NULL column would have no value written to it.
  • bun.lock — resolves to 1.7.1, the version CI already installs.

The Kysely path (better-auth:migrate) needs no change — it builds its tables from Better Auth's own getMigrations(), so it picked up issuer on its own.

Not included: Better Auth also generates a unique index account_issuer_accountId_uidx. Neither schema here carries any of its indexes today (not session_userId_idx, account_userId_idx, or verification_identifier_idx), and nothing in 1.7 depends on it — there is no ON CONFLICT path in the library — so adding indexes is left as a separate consistency pass.

Verification

bun run check-types, bun run lint, bun run test all pass.

E2E on the three engine paths that run in this environment, 13/13 tests each, including the auth: email/password flow case that was failing:

Combo Path
react+hono+cloudflare+better-auth+sqlite D1 migration (Kysely adapter)
react+fastify+better-auth+sqlite+drizzle Drizzle schema
react+hono+better-auth+sqlite better-auth:migrate (Kysely)

The postgres+drizzle combos could not run locally (no Docker daemon); their schema change is the sibling branch of the same file, and CI covers them.


Generated by Claude Code

Better Auth 1.7 scopes account identity by issuer and adds a required
`issuer` column to the `account` table. Bati's hand-maintained schemas
were still on the 1.6 shape, so every scaffolded better-auth app broke on
sign-up: "table account has no column named issuer".

Adds the column to both schemas Bati owns — the wrangler D1 migration and
the Drizzle schema (pg + sqlite). The Kysely path needs no change: it
creates its tables through Better Auth's own `getMigrations()`.

Raises the dependency floor to ^1.7.1 so the shipped schema and the
library agree; on 1.6 the new NOT NULL column would have no value to
write.

Verified with the e2e suite on the three engine paths available locally —
cloudflare/D1 (Kysely), sqlite+drizzle and plain sqlite (Kysely migrate)
— all 13 tests each, including the `auth: email/password flow` case that
was failing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TmqiAZZAABaDst6wAZpUxf
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 16 minutes.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e068152e-b2b3-4180-82f8-39c02c2756d2

📥 Commits

Reviewing files that changed from the base of the PR and between c0819df and c728619.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • boilerplates/better-auth/files/database/drizzle/schema/auth.ts
  • boilerplates/better-auth/files/database/migrations/$better-auth.sql.ts
  • boilerplates/better-auth/package.json
  • boilerplates/react-better-auth/package.json
  • boilerplates/solid-better-auth/package.json
  • boilerplates/vue-better-auth/package.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…vike-b23iof

# Conflicts:
#	boilerplates/better-auth/files/database/drizzle/schema/auth.ts
@brillout brillout closed this Aug 25, 2026
@brillout
brillout deleted the claude/commit-author-vike-b23iof branch August 25, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants