Skip to content

Generated MySQL auth schema uses TIMESTAMP(3), so a 1960 birthday fails signup #967

Done

Description

@hyfdev

On MySQL, the auth schema from void db generate stores Better Auth's dates as TIMESTAMP(3), while the tables vite dev creates use DATETIME(3).

TIMESTAMP can't hold dates before 1970, so once the generated migration is applied, signing up with a 1960 birthday returns 422 FAILED_TO_CREATE_USER.

The same signup returns 200 on tables that vite dev created.

To reproduce in Void 1.12.2 with DATABASE_URL pointing at MariaDB, set database: { dialect: 'mysql' } and auth: { providers: ['email'] } in void.config.ts, and add this auth.ts:

import { defineAuth } from 'void/auth';
export default defineAuth(({ defaults }) => ({
  ...defaults,
  user: { additionalFields: { birthday: { type: 'date', required: false } } },
}));

Run void db generate and void db migrate, start vite dev, and sign up with a 1960 birthday:

curl -i http://localhost:5173/api/auth/sign-up/email \
  -H 'Content-Type: application/json' -H 'Origin: http://localhost:5173' \
  -d '{"name":"a","email":"a@example.com","password":"password1234","birthday":"1960-01-01T00:00:00.123Z"}'

#968 fixes it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions