Alcadeus
Alcadeus5mo ago

Bug when using convex auth with password

Not sure if this is a bug but when following the docs https://labs.convex.dev/auth/config/passwords#add-sign-in-form for using convex auth with passwords, but when doing a sign up via the sign in function, I am getting back an error about the providerID? It should be created right?
Uncaught Error: Uncaught Error: Index authAccounts.providerAndAccountId not found.
at createAccountFromCredentialsImpl (../../node_modules/@convex-dev/auth/dist/server/implementation/mutations/createAccountFromCredentials.js:26:34)
at storeImpl (../../node_modules/@convex-dev/auth/dist/server/implementation/mutations/index.js:93:8)
at handler (../../node_modules/@convex-dev/auth/dist/server/implementation/index.js:280:12)

at async createAccount (../../node_modules/@convex-dev/auth/dist/server/implementation/index.js:327:0)
at async authorize [as authorize] (../../node_modules/@convex-dev/auth/dist/providers/Password.js:52:20)
at async handleCredentials (../../node_modules/@convex-dev/auth/dist/server/implementation/signIn.js:102:19)
at async handler (../../node_modules/@convex-dev/auth/dist/server/implementation/index.js:245:20)
Uncaught Error: Uncaught Error: Index authAccounts.providerAndAccountId not found.
at createAccountFromCredentialsImpl (../../node_modules/@convex-dev/auth/dist/server/implementation/mutations/createAccountFromCredentials.js:26:34)
at storeImpl (../../node_modules/@convex-dev/auth/dist/server/implementation/mutations/index.js:93:8)
at handler (../../node_modules/@convex-dev/auth/dist/server/implementation/index.js:280:12)

at async createAccount (../../node_modules/@convex-dev/auth/dist/server/implementation/index.js:327:0)
at async authorize [as authorize] (../../node_modules/@convex-dev/auth/dist/providers/Password.js:52:20)
at async handleCredentials (../../node_modules/@convex-dev/auth/dist/server/implementation/signIn.js:102:19)
at async handler (../../node_modules/@convex-dev/auth/dist/server/implementation/index.js:245:20)
Passwords - Convex Auth
Authentication library for your Convex backend
8 Replies
sshader
sshader5mo ago
Set Up Convex Auth - Convex Auth
Authentication library for your Convex backend
Alcadeus
AlcadeusOP5mo ago
Yes, I have done that.
sshader
sshader5mo ago
And npx convex dev completed successfully? This error is saying you're missing an index that should've been added by this step. Another way to check is to check that the table appears in the Convex dashboard under the data page and that the index appears when you open "Schema and Indexes" from the three dots menu
Alcadeus
AlcadeusOP5mo ago
I see, the table does not appear under my dashboard but npx convex dev runs successfull I will try redoing the auth setup again Nope still the same issue persists.
sshader
sshader5mo ago
I'd double check that your UI is talking to the correct convex backend (log the URL where you instantiate your ConvexReactClient and make sure that matches the URL you see under deployment settings). Also sounds like npx convex dev is deploying to a different deployment than what you're viewing in the dashboard if it's succeeding and you've included the auth tables. I'd run npx convex dashboard to make sure you're viewing the right deployment.
Alcadeus
AlcadeusOP5mo ago
It appears to be talking to the correct backend, (plus I only have one active project)
No description
sshader
sshader5mo ago
Here's what I have for a similar working app: * My convex/schema.ts file looks like this
import { defineSchema } from "convex/server";
import { authTables } from "@convex-dev/auth/server";

const schema = defineSchema({
...authTables,
// other tables
});

export default schema;
import { defineSchema } from "convex/server";
import { authTables } from "@convex-dev/auth/server";

const schema = defineSchema({
...authTables,
// other tables
});

export default schema;
* npx convex dev runs and shows a green check mark + a message that my functions are ready * CTRL+C-ing out of npx convex dev and then running npx convex dashboard opens the dashboard, and I see the authAccounts table on the data page * The happy-animal-123 name in the tab opened by npx convex dashboard matches the one in the tab showing the logs from my auth requests. When I change my client code to log the URL, it matches too, e.g
console.log(process.env.NEXT_PUBLIC_CONVEX_URL)
const client = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL)
console.log(process.env.NEXT_PUBLIC_CONVEX_URL)
const client = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL)
Alcadeus
AlcadeusOP5mo ago
Okay so i tested by making a new barebones react native app and running the steps. It works I am not sure what was causing it to not work

Did you find this page helpful?