Error when using withIndex (Index not found)
I can't seem to get indexes to work at all. I keep getting an Index not found error. I have attached the error message, my schema and query.
I am able to get the query to work using filter but I want to take advantage of withIndex for perfomance. I even tried just a simple userId index and that didn't work either. Same error. Any idea what I could be doing wrong?
4 Replies
Here is the query that's not working
this query below works fine
In the convex logs I can confirm the userId and category name is valid.
Things I'd check:
* Your
convex/schema.ts
defines the index (name matches, fields match)
* Your npx convex dev
command has run successfully
* The index shows up in the Dashboard under Data > testItems
> three dot menu > Schema and IndexesGreat this worked! My issue was in the
schema.ts
file. I didn't have it set up correctly. Thank you so much