BlazeApleos
BlazeApleos2d ago

ConvexAuth Uncaught Convex Error

I'm trying to setup ConvexAuth and customize the validatePasswordRequirements. I'm copying the format in the example here, but I get this error: [0] Hit error while running auth:signIn: [0] Error [ConvexError]: [Request ID: 0d38fe217298c763] Server Error [0] Uncaught ConvexError: INVALID_PASSWORD_PASSWORD_MISSING_NUMBER [0] at validatePasswordRequirements [as validatePasswordRequirements] (../../convex/auth.ts:32:9) ... [0] at validatePasswordRequirements [as validatePasswordRequirements] (../../convex/auth.ts:32:9) { [0] data: 'INVALID_PASSWORD_PASSWORD_MISSING_NUMBER' [0] } It looks like the ConvexError is not communicated properly and is instead just a regular Error. A really simplified example: I throw this in my validation:
if (!/\d/.test(password)) {
throw new ConvexError(INVALID_PASSWORD_PASSWORD_MISSING_NUMBER)
}
if (!/\d/.test(password)) {
throw new ConvexError(INVALID_PASSWORD_PASSWORD_MISSING_NUMBER)
}
I log this:
.catch((error: unknown) => {
if (error instanceof ConvexError) {
console.error('Error is a Convex Error')
console.error('Error: ', error.data)
} else {
console.error('Not a Convex Error')
}
.catch((error: unknown) => {
if (error instanceof ConvexError) {
console.error('Error is a Convex Error')
console.error('Error: ', error.data)
} else {
console.error('Not a Convex Error')
}
It outputs:
Not a Convex Error
Not a Convex Error
Am doing something obviously wrong? Is this not expected to work? Thanks for your help!
GitHub
convex-auth/test/src/auth/SignInWithPassword.tsx at main · get-con...
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
3 Replies
Convex Bot
Convex Bot2d ago
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!
BlazeApleos
BlazeApleosOP2d ago
Looks like I'm hitting this case and it's not indended to return a ConvexError
GitHub
convex-auth/src/nextjs/server/proxy.ts at main · get-convex/convex...
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
BlazeApleos
BlazeApleosOP2d ago
Unfortunately, that source does log out massive errors to my server console. The expectation with validatePasswordRequirements is: "If the provided password is invalid, implementations must throw an Error", so logging the error as it currently does doesn't seem to align with that instruction. In other words, we don't need a server log when a user inputs a password that doesn't meet the requirements. I can handle this with client side checks, but perhaps something for the Convex team to look at.

Did you find this page helpful?