Baij
Baij2mo ago

Why is api.users.current showing error

I asked gemini to fix, gemini is also using "api.users.current" in its code. But my vscode is showing error. Here is the picture of error. What is the issue?
No description
No description
22 Replies
erquhart
erquhart2mo ago
You’re trying to call a Convex query that returns the current user - have you written a query to do that? If you create file at convex/users.ts and export a Convex query named “current”, the code you have would be correct. Then you just need the query to get and return the user.
Baij
BaijOP2mo ago
I have already done that.
No description
erquhart
erquhart2mo ago
Are you running npx convex dev?
Baij
BaijOP2mo ago
bunx convex dev
erquhart
erquhart2mo ago
The file with that query, can you confirm it’s at convex/users.ts? The error is saying there’s no file exporting public convex functions there.
Baij
BaijOP2mo ago
do you mean that file that contains "current" function?
Baij
BaijOP2mo ago
No description
erquhart
erquhart2mo ago
yeah that's it hmm What's in your _generated/api.js file
Baij
BaijOP2mo ago
No description
erquhart
erquhart2mo ago
sorry, api.d.ts
Baij
BaijOP2mo ago
No description
erquhart
erquhart2mo ago
yeah it only sees auth.ts and http.ts convex dev is running with no errors?
Baij
BaijOP2mo ago
I was following a tutorial, when in between of a lecture i stumbled upon this problem. I haven't completed the complete tutorial, so I am pretty sure it will give error.
erquhart
erquhart2mo ago
but convex dev is running right now right? any errors from it?
Baij
BaijOP2mo ago
lemme open just a sec
Baij
BaijOP2mo ago
no issue
No description
erquhart
erquhart2mo ago
Is the error still there
Baij
BaijOP2mo ago
no, issue is not there.
No description
Baij
BaijOP2mo ago
what happened, why did that line go away ?
erquhart
erquhart2mo ago
convex dev generates an api from your convex functions - if you make or change functions without it running, the generated api doesn't update So you'll just want to keep it running when you're working on the project.
Baij
BaijOP2mo ago
Thanks Buddy, for your help 😀
erquhart
erquhart2mo ago
no problem, happy convexing

Did you find this page helpful?