Inferring additional fields on hooks

The additional field role is not found inside the databasehooks. I ran better-auth/cli generate and prisma migrate as you can see the screenshot from the prisma studio , the user table have that column. I also tried restarting the TS server on vscode which did not solve the issue
No description
No description
Solution:
Hey guys ( @aswnss, @Rufis ), this is a known limitation of Better-auth. However I do have a PR which fixes this. Once merged your issue will be resolved. You can track the PR here: https://github.com/better-auth/better-auth/pull/2158...
GitHub
refactor: betterAuth fn now infers models by ping-maxwell · Pull...
We now infer models based on the options: Previously: How? The betterAuth function now has generics for plugins, as well as any model data that could be modified by options, such as User additio...
Jump to solution
6 Replies
aswnss
aswnssOP2w ago
It is not being passed as well, getting undefined when console logged
<-- POST /api/auth/sign-up/email
undefined
<-- POST /api/auth/sign-up/email
undefined
aswnss
aswnssOP2w ago
It is inferred outside the auth
No description
Rufis
Rufis2w ago
I am having the same issue, I was thinking it was just me who had this
Solution
Ping
Ping2w ago
Hey guys ( @aswnss, @Rufis ), this is a known limitation of Better-auth. However I do have a PR which fixes this. Once merged your issue will be resolved. You can track the PR here: https://github.com/better-auth/better-auth/pull/2158
GitHub
refactor: betterAuth fn now infers models by ping-maxwell · Pull...
We now infer models based on the options: Previously: How? The betterAuth function now has generics for plugins, as well as any model data that could be modified by options, such as User additio...
Rufis
Rufis2w ago
Thanks for everything, honestly making auth so easy to use :pepe_love:
aswnss
aswnssOP2w ago
That is great . For my issue though I wanted to create a new entry to the db and then link that to the user entry before or after the user was created . Something like "Initialise the other things that user is connected to". What i did was I extended the user table with an empty field linkedId and then will later initialize the other stuff later by an api call and link it after wards. Could have done this with database hook though , when your pr is merged @Ping
No description

Did you find this page helpful?