Seeding doesnt work
It crashes because better-auth throws away the id here: https://github.com/better-auth/better-auth/blob/0127426a5e7df4d011e27f510a6e177561f3b618/packages/better-auth/src/adapters/create-adapter/index.ts#L541
GitHub
better-auth/packages/better-auth/src/adapters/create-adapter/index....
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
12 Replies
Changing the table name for the organization table also didnt work with:
Do you have a need where the
id
must be predefined?GitHub
better-auth-kit/packages/libraries/seed/src/helpers/users.ts at 110...
A collection of plugins, tools, libraries, examples, and more for Better-Auth. 🚀 - ping-maxwell/better-auth-kit
That's where it gets manually created. Makes sense why, easier to create an ID sync and prepare all to be inserted objects first, but it does make it not work anymore. Probably just something that got in due to a refactor 2 weeks ago
Hey do you have any logs or more info to share?
I tried it on my end and it works.
Just using something like this:

On latest Better-auth.
I'll test this now.
Seeding organization works with custom
organization
model name too 🤔

Hey, sorry, fell asleep. Weird that it works for you so easily. I don't have the file anymore but I was seeding users, orgs etc. I'll create my setup again
seed.ts:
auth.ts
@better-auth-kit/[email protected] [email protected]
Thanks for the library btw, appreciate the work!@Firro Are you able to remove
modelNames
in the organization options part?
The seed tool will pick up on your auth config defined modelName for organization
In saying that, I will probably remove that modelNames
part given such ^
I just tried to seed using the same user
configuration as you and it works 🤔Also here's a cool tip:
You can define the generics for the seed helpers to not get type errors if certain tables have rows that are not default to BetterAuth, eg:
