ArgumentValidationError only in prod deployment?
I have a relatively simple action that pulls some data and returns it (and on the client side it passes this array to a mutation). I added a try/catch so that if the error is a 401, I just return a string rather than an array of data. On the client side, I have an if response === “private” return; so it breaks early without trying to pass data onto the next mutation.
This works great locally but the moment I push it to prod, I get all of these ArgumentValidationErrors which functionally takes down the site. I’d love to be able to just test things out and figure out what’s really causing this but it’s hard to justify doing that when it takes down the site for every user on it .
Any tips or advice here? Not quite sure why this is happening or if there’s a way to recreate this locally!
5 Replies
I realize I can probably just copy/paste my client side code and put it at a different page on the website and then modify to use that to test! So will keep this thread updated on if I figure it out but would love any pointers if helpful in thinking about the difference between running locally vs in prod wrt these errors
Have you checked the logs screen in the dashboard of your prod deployment to see if there is any info? Is there anything different about the input expected in prod from dev?
To clarify, the error logs of ArgumentValidationError are occurring only on prod! (I receive them in logs). On local, the same input will lead to a successful run compared to in prod (no logged errors)
Okay hm very weird, for some reason the problem is now gone when I created a test page and attempted in prod! Perhaps it was a weird short-term error.
Separately, I ended up just throwing a ConvexError to communicate with the client
Thanks for the help regardless Indy!
Sounds like you've learned this already and switched to
ConvexError
, but errors appear differently in prod vs. dev (https://docs.convex.dev/functions/error-handling/#differences-in-error-reporting-between-dev-and-prod).
But sounds like you were seeing no errors in dev, but errors in prod? One thing to be aware of here is version skew -- I can update my Convex functions (let's say changing a function to accept one more argument) and there might be an end user with an old browser tab that passes in the old function arguments (until the user refreshes).
Version skew can also technically happen in dev, but typically we're running a command that updates Convex functions and reloads the frontend in parallelError Handling | Convex Developer Hub
There are four reasons why your Convex
Oh, version skew that makes so much sense! Thank you!