Do i have to re-write the validation again ??
i've been using this convex saas template and found this piece of code, the two thing is basically the same thing. I tried to refactor the mutation using
schema.table.subscriptions.validator
. The function compiles fine in the cloud, however when running the function im getting this error where my validator is just an empty object.10 Replies
the function you are getting failure on seems different then what you pointed.
check subscriptions.ts /insertNewSubscription and see there's a field 'billingInterval' missing. you would be getting type safe errors there too.
my code is correct, i just take different snapshot in different time
else im getting type error in the first place
so what and where exactly the error is ?
here's the right one
i previously use
organizationSubscriptionValidator
then im getting the object contains extra field
error
with thiscan you console log the
args.organizationSubscription
after line no 22 in handler
to see why there's an extra field billingInterval
and if this field is in your schema of convex for this table.it fails on args validation
because its expecting empty object, like i shared in the image above
You might check that there isn't an import cycle where it's
undefined
when the file is first parsed. that's my guess @ibrahimyaacob
JavaScript does a funky thing with import cycles where it evaluates one of them with the other as undefined, then evaluates the other, then at runtime both are defined. But static-time definitions can end up storing undefined values, such as defining consts / args validators.
You could try inlining that into your arg validator to test, or move it into its own file and import from there to see if that helpsright now i end up replicating the validator (schema & args). i guess its fine for now.
i trust you guys will fix this in the future