Skip to content

TanStack Db Web Starter better-auth integration fails #3503

@thruflo

Description

@thruflo

The tanstack-db-web-starter template fails to run due to a better-auth compatibility issue with TanStack Start.

The error

TypeError: Cannot read properties of undefined (reading 'body')
      at get body [as body] (node:internal/deps/undici/undici:9946:29)
      at getBody ([email protected]/src/utils.ts:7:15)
      at processRequest ([email protected]/src/router.ts:191:14)

Steps to reproduce

npx gitpick electric-sql/electric/tree/main/examples/tanstack-db-web-starter my-tanstack-db-project
cd my-tanstack-db-project
pnpm install
pnpm dev

Try and login. Auth fails with the above error.

Image

Environment

  • Node.js: 20.19.0 (also fails on 22.12.0)
  • better-auth: 1.4.2
  • better-call: 1.1.0
  • TanStack Start: 1.139.6
  • Vite: 7.2.4

Attempted fix

Adding the tanstackStartCookies() plugin to src/lib/auth.ts (as recommended in better-auth docs) does not resolve the issue.

Impact

This blocks the @electric-sql/start quickstart package from being deployed, as generated apps fail immediately on startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions