Type problems with Convex functions in NextJS

I'm trying to use Convex functions with NextJS and I'm running into multiple type problems that I'm unable to solve. First, some namespaces under api have only a generic record type and no functions are available. If I try to use those that have functions in them, I get just any as the return type from fetchQuery. Does anybody know what may be the problem here?
No description
No description
No description
6 Replies
ampp
ampp3mo ago
fetchQuery is only for server side? so not usable in the convex folder. I cant tell exactly what you are up to so that's my best guess
Vojtěch Perník
Vojtěch PerníkOP3mo ago
I can send more of the code tomorrow, but yeah, I'm trying to use it in the actual next code, not in the Convex folder
ampp
ampp3mo ago
the vast majority of people here use "use client" at the top of the page with useQuery() useMutation() etc. Especially if you are just getting into convex. I still haven't used fetchQuery and ive been using convex daily for over a year 😅
Vojtěch Perník
Vojtěch PerníkOP3mo ago
I'm migrating to Convex an app that used Neon before and I'm using UploadThing for file uploads, I don't want to migrate this away and I need to store the file references in Convex somehow. In UploadThing you need to write a function that would serve as a webhook when the upload is done, so you can store that in the DB. But actually I think that using useQuery wouldn't help even if I could use it, because of the strange types of the api object. Isn't there someone who would know what could be the cause?
erquhart
erquhart2mo ago
When running npx convex dev do you get any errors?
Vojtěch Perník
Vojtěch PerníkOP2mo ago
I've solved that! The problem was, that I've changed the tsconfig.json file in the convex/ folder...

Did you find this page helpful?