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:signInauth: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!