Skip to content

@zenstackhq/better-auth - findOne and findMany pass select: undefined to Zenstack #2542

@rianzietsman

Description

@rianzietsman

Description and expected behavior
When findOne or findMany are called without a select parameter, the adapter passes select: undefined to Zenstack's query methods. In Zenstack/Prisma, this is treated as an explicit instruction to select zero fields, rather than selecting all fields.

When no select is specified, all fields should be returned (default Prisma behavior)

Steps to reproduce

  1. Call adapter.findOne({ model: 'twoFactor', where: [...] }) without a select parameter
  2. Observe that the returned object has no fields (or only some fields)

Environment (please complete the following information):

  • ZenStack version: 3.5.3
  • better-auth 1.5.6
  • Database type: Postgresql
  • Node.js/Bun version: 20.19.2
  • Package manager: npm

Additional context
When verifying a 2FA backup/recovery code, a downstream query fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions