noob saibot
noob saibot6mo ago

Convex Auth Magic Link with Resend: Uncaught Error: Uncaught Error: Index users.email not found.

I'm trying to setup the new Convex Auth in with Magic Link my Nextjs app. I'm following the official tutorial and the demo app. When I call signIn("resend", formData), I'm getting the error:
error Error: [CONVEX A(auth:signIn)] [Request ID: 09412de9cb7c47e3] Server Error
Uncaught Error: Uncaught Error: Index users.email not found.
at uniqueUserWithVerifiedEmail (../../../../node_modules/@convex-dev/auth/dist/server/implementation.js:881:43)
error Error: [CONVEX A(auth:signIn)] [Request ID: 09412de9cb7c47e3] Server Error
Uncaught Error: Uncaught Error: Index users.email not found.
at uniqueUserWithVerifiedEmail (../../../../node_modules/@convex-dev/auth/dist/server/implementation.js:881:43)
I must have done some error somewhere but since this is very new, I can't figure out where to look at. I'm running this on localhost. Here is my auth.config setup:
export default {
providers: [
{
// old setup used before advent of "convex auth"
domain: process.env.CONVEX_AUTH_PROVIDER_DOMAIN,
applicationID: "convex",
},
{
// new setup from auth tutorial
domain: process.env.CONVEX_SITE_URL, // <-- new config
applicationID: "convex",
},
],
};
export default {
providers: [
{
// old setup used before advent of "convex auth"
domain: process.env.CONVEX_AUTH_PROVIDER_DOMAIN,
applicationID: "convex",
},
{
// new setup from auth tutorial
domain: process.env.CONVEX_SITE_URL, // <-- new config
applicationID: "convex",
},
],
};
5 Replies
ian
ian6mo ago
What does your users table look like? Did you do step 3 here or do you have a custom one? https://labs.convex.dev/auth/setup#add-authentication-tables-to-your-schema
Set Up Convex Auth - Convex Auth
Authentication library for your Convex backend
noob saibot
noob saibotOP6mo ago
@ian I did spread the authTables object. But I also already had a custom users table which I kept. (I added missing fields though)
ian
ian6mo ago
You can either add the missing index (see the schema here, or implement a custom createOrUpdateUser callback to manage the account linking & creation yourself: https://labs.convex.dev/auth/advanced#controlling-account-linking-behavior
Advanced: Details - Convex Auth
Authentication library for your Convex backend
Customizing Schema - Convex Auth
Authentication library for your Convex backend
ian
ian6mo ago
I'd suggest implementing createOrUpdateUser
noob saibot
noob saibotOP6mo ago
Ok, I fixed the issue: I defined the email index as by_email. I corrected it and it worked.

Did you find this page helpful?