MySQL (Planetscale): Cannot read properties of undefined (reading 'name')
Hi
Hopefully someone can help me. I'm getting the above error in my insert query.
I have no idea what I'm doing wrong...
18 Replies
Partial error stack:
Can you show a code where you creating db?
yes
Sorry, had to split because of message limits.
I mean db = drizzle(…)
ah, it's planetscale
do you have monorepo project?
do you have 1 or multiple drizzle-orm instances installed?
i have a monorepo but it's the first app in it with drizzle-orm
other inserts seem to work fine. but i think i'll check again.
also, mysql:push is working
yep, just tried the following insert and that works:
okey, so another table is working
I have 1 more question, could you please check if you have imported
serial
, int
, etc, from /mysql-core
for ticketInvitations
tablethe imports:
a single file per schema. with zod schemas in it. (same as with the
guests
schema, just different name)I can't see a reason why it breaks
cc @Dan Kochetov maybe you can check when you'll have some time?
oh
ah, and i've tried
@beta
in the meantime. same errorI see, that in first example you are using array and in second just an object
could you check to run first query(that you have troubles with) without an array
just to check if array causing it
ah, yeah. i've tried
values[0]
as well
but i'll quickly try again
same issue
Could you try installing
drizzle-orm
in the monorepo root using -w
?i just found the issue
like in this second.
i'm stupid and forgot to define the amount column 🤦♂️
I'm so so sorry
That's ok
We actually need to improve the types there by not allowing unknown keys
Glad it's sorted out
I'm so getting used to typesafety with this project (trpc, drizzle, zod).
And the error message doesn't mention amount. But stricter typing will easily be enough.
Again: Sorry!
Just a small bump on this since I also encountered this issue and was confused for a while for the same reasons as OP. This seems to be a typescript issue? I.e. in my case this gives no error
but the following gives the correct type error
and removing the relation fields fixes both the type error and the error from drizzle. Perhaps then the best solution is to handle this error and throw a descriptive error from drizzle