natedunn
natedunn2w ago

Dashboard issue with schema

ok it was some minor trickery i was doing in my schema and while it was typesafe it did not like it on the dashboard
7 Replies
Nicolas
Nicolas2w ago
Do you know what in your schema caused the issue?
natedunn
natedunnOP2w ago
It was an error on my part but sure I can show you I have a simple helper function:
export function defineZTable<T extends z.ZodObject<any>>(schema: T) {
return defineTable(zodOutputToConvex(schema));
}
export function defineZTable<T extends z.ZodObject<any>>(schema: T) {
return defineTable(zodOutputToConvex(schema));
}
but i was accidentally spreading the object instead:
export function defineZTable<T extends z.ZodObject<any>>(schema: T) {
return defineTable({ ...zodOutputToConvex(schema)});
}
export function defineZTable<T extends z.ZodObject<any>>(schema: T) {
return defineTable({ ...zodOutputToConvex(schema)});
}
it type checks ok and send it to the cloud, but obvious breaks when try to display the info. hopefully that helps so you can catch that error before it syncs
Nicolas
Nicolas2w ago
How exactly did that break on the dashboard? It sounds like it made the dashboard crash, is it the case?
natedunn
natedunnOP2w ago
@Nicolas
No description
Nicolas
Nicolas5d ago
Thanks @natedunn! I could reproduce the issue, I’m working on a fix Hi @natedunn! We just released convex@1.24.2 on NPM, it contains a fix that makes sure the code push fails if you attempt to do something like you were doing in the schema
Nicolas
Nicolas5d ago
GitHub
Fix defineTable({ ...v.object({}) }) handling (#37561) · get-con...
When writing code like defineTable({ ...v.object({}) }), the validator’s attributes are copied but not getters, including json which is used during the table definition export. This means that...
Nicolas
Nicolas5d ago
Also a fix for the dashboard is on its way to make sure it doesn't crash

Did you find this page helpful?