User index not found / re-created
@simonjbest : Hi, I've been using your recommended code for authentication (https://docs.convex.dev/auth/database-auth) and have a by_token index on the users table defined in my schema.ts file. This has worked fine for some time but I'm now getting the error "Index users.by_token not found". It tries to add the index every time it deploys updated functions ( [+] users.by_token ["tokenIdentifier","_creationTime"] ) but I don't see the index on the Schema and Indexes page in the app. What do I need to do to get this working again?
Storing Users in the Convex Database | Convex Developer Hub
You might want to have a centralized place that stores information about the
7 Replies
Hey @simonjbest this definitely seems confusing. A few questions to start off:
1. Is this a dev or prod instance you're deploying / looking at the dashboard for?
2. Is there a chance there's a
convex dev
instance running on an older version of the code somewhere, that's overwriting your schemas? or a convex deploy
getting executed from somewhere else?
3. Is the CONVEX_URL (backend deployment address, passed into the Convex client) what you'd expect?~seeing the same issue randomly, was working fine and now not~ i had bad data in my db from testing it works now..
Hey @ian, thanks for the reply. Re. 1 this is a dev instance I'm using. Re. 2 I just restarted to make sure there are no stray processes lurking and I'm seeing the same error. Re. 3 the CONVEX_URL is set via NEXT_PUBLIC_CONVEX_URL in .env.local and is set to "https://doubtful-reddeer-27.convex.cloud" so looks good.
@nate how did you fix this exactly? What was the bad data you had in the db from testing?
I've tried clearing my users table completely but still getting the same error related to the missing index
it wasnt my user table at all, i was adding a new table and had the schema correct. started getting your same error at some point... ended up removing node_modules, and updated the convex lib from ~0.13.x to ~0.14
it then told me i had some schema issues, i fixed it and then it kept complaining about one table so i looked at the data and realized i passed a literal in the wrong case 'chat' vs 'Chat' where my schema wanted 'Chat'
Thanks for the tips. I'm one minor version behind so will try updating now and see how I get on 🙂
hi @simonjbest ! we've found the issue on our side and we're working on remediating. the issue affects versions <0.14.0 so upgrading should also fix it. thanks for reporting!
Btw, this should be fixed for older versions too. No upgrade required (although upgrades are always good in general).