Cannot store/validate `undefined` in array?
Just making sure I'm not missing something
8 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
If I pass something like ["a", "b", undefined] to a convex function, it doesn't get called but I also don't see any errors anywhere..
I know that
undefined
is scrubbed if passed as a single argument value to a function (more info from the Convex side in this thread), but I wouldn’t expect it to scrub an entire function call if a single array value is undefined
.@David Alonso How are you passing this? You should get an error like
However if you have a layer of indirection where you serialize the object yourself, it could be null:
Is there any way possible to get a line number on where the error is, my system is so complex now i cant find these, it takes at least a hour of placing console logs. One time it was a query was getting a object when i was looking for a insert. Or is there some general way to protect all convex functions from this. 😅
Im wondering if one of my functions is serializing a field starting with a underscore..
ive been indecisive about this object design and its screwed me over
ugg this one caught me again.. i now remember.. the mutation attempts to serialize my payload on the final return and if a sub sub object doesnt searlize right its mostly invisible to me. I don't use a return validator for performance reasons.
I think what is making this so hard is that both the console.log below in the function never output anything: so as far as im concerned the code is breaking before, but its only fixed if i fix the returned data or return void.
Uncaught Error: BadObject {bad object data} To learn about Convex's supported types, see https://docs.convex.dev/using/types.
In your code snippet you have the literal word
or
instead of the "or" operator ||
. Not sure if that could be contributing to any of the issues you're experiencing.Yeah, its not that. I was just showing i had 2 ways of creating. I'd like to repo somehow, this has been the only time I've seen a error that prevents the console logs from outputting