Server additionalFields Error
When following this example from the docs: https://www.better-auth.com/docs/concepts/database#extending-core-schema, I get a few errors, based on the request I send.
If i execute this I get
Where is this going wrong?
ROLE_IS_REQUIRED
error, but there was no Typescript error, which is not good. Also why do I get this error if I have defined a default value in my auth instance?
When I execute this request, I get a long error, with this message: SQLite error: NOT NULL constraint failed: user.role
,Where is this going wrong?
Database | Better Auth
Learn how to use a database with Better Auth.
5 Replies
Oops, user error.
instead of
But the weird thing is that there was no type error in that. Here is a screenshot of the type of additionalFields, where default is highlighted pink. Is this some kind of typescript bug?

@remakker hi, so you mean docs is old? https://www.better-auth.com/docs/concepts/database#extending-core-schema
Database | Better Auth
Learn how to use a database with Better Auth.
No, I wrote
default
instead of defaultValue
, so I did not follow the docs.oh, ok