[1.4.0] Wrong default value for additional fields

Just updated to 1.4.0 and changed the default flow of the additional field. defaultValue: () => nanoid() But in the DB I see just a body of the function instead of a value: () => nanoid()
No description
No description
7 Replies
Ping
Ping•2d ago
I wonder if that is caused by our CLI, can you show me what is in your drizzle schema? It's possible it's a bug during the schema generation which converted your function into a string and set it as a default value.
Valerii Strilets
Valerii StriletsOP•2d ago
there is no any extra function, just text().notNull()
No description
Valerii Strilets
Valerii StriletsOP•2d ago
okay, I opened the source-code that's because of required: true
No description
Ping
Ping•2d ago
The code should had called your function and giving you the nanoid though? 🤔 How was this first triggered? What endpoint did you hit when trying to create the user?
Valerii Strilets
Valerii StriletsOP•2d ago
@Max I called /sign-up/email (authClient.signUp.email) but the generated SQL with Drizzle doesn't contain any () => nanoid(), hm... insert into "users" ("id", "created_at", "updated_at", "name", "email", "email_verified", "image", "two_factor_enabled", "normalized_email", "is_anonymous", "secret") values ($1, $2, $3, $4, $5, $6, default, $7, $8, $9, $10) returning "id", "created_at", "updated_at", "name", "email", "email_verified", "image", "two_factor_enabled", "normalized_email", "is_anonymous", "secret" -- params: ["019aac53-d0ff-711e-8d09-b6f2b9d398a0", "2025-11-22T16:09:25.503Z", "2025-11-22T16:09:25.503Z", "121`", "tetst22@gmail.com", false, false, "tetst22@gmail.com", false, ]
bekacru
bekacru•2d ago
should be fixed on 1.4.1
Valerii Strilets
Valerii StriletsOP•2d ago
thanks!

Did you find this page helpful?