-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exceptions thrown in ConvexCredentials.authorize() are unhandled #65
Comments
I believe this is just the logging that's confusing -- it's logging that the server function threw an error, but the error is still catchable on the client (so it's an uncaught error from the perspective of the server, but not necessarily from the perspective of the client, even though this message will appear in client logs). The
The Convex Auth library could be wrapping all non-ConvexErrors thrown during |
@sshader I really appreciate how responsive you are! I also thought this at first, but I get weird unhandled errors on the client side too. If it's working for you it may be somehow environment-specific, I'm not sure. Here's the sample code I just tried and the error that happened: function dotest() {
signIn('simple-auth').catch((e) => {
if (e instanceof ConvexError) {
window.alert('Convex Error!')
window.alert(`Convex Error!\nData: ${JSON.stringify(e.data)}`)
} else {
console.error('#### caught unknown error', e)
throw e
}
})
} There is no alert fired. I do get this on the browser dev console:
So you see - it's not getting a ConvexError, it's getting some secondary exception that has been fired due to JSON.parse throwing. |
this is so frustrating... its giving uncought error on the client side... and even though you catch it... it logs to the console...
|
@doublemarked -- could you share more about what browser you're using + what version of Convex + Convex Auth, because I can't reproduce this (in case it is environment specific). I'm also curious what the dashboard logs say (i.e. do they show your ConvexError, or something else) to rule out the possibility that you're hitting some other error before we even hit the ConvexError. Also noted that the logging the error is frustrating -- will file that internally as an area of improvement for Convex since it's pretty separate from Convex Auth. |
Hey @sshader! 👋 I've created for you an extremely distilled sample project that reproduces this: https://github.com/doublemarked/convex-auth-error Let me know if you're able to reproduce using that project. I am testing with Node v20. |
I have been using Convex Auth with React Native as i got those error logs... |
Hey just wanted to share that trying to throw an error on
Also ends up with the same error mentioned by @doublemarked caught on the client side:
|
@labigalini why in earth a thumb down?? |
still not solved |
Overview
Exceptions (including ConvexError) are unhandled when thrown from a ConvexCredentials.authorize() method.
Setup
Outcome
Expected outcome
At minimum, the exception should be caught by Convex. But ideally, throwing an exception from authorize() should bubble up to the client side so that the client can handle the error. We should be able to use exceptions or some other mechanism to communicate failure conditions to the client during authorize() in order to better control the authorization process.
The text was updated successfully, but these errors were encountered: