KenV
KenV9mo ago

can't find api route

i can't use useAction my api is not found any suggestion?
No description
18 Replies
jamwt
jamwt9mo ago
usual couple of gut checks are 1. are you sure npx convex dev is running? 2. are your actions exported? 3. do you see the actions listed in your dashboard?
KenV
KenVOP9mo ago
yes it is running the actions are exported yes i see the actions in my dashboard
KenV
KenVOP9mo ago
No description
No description
No description
KenV
KenVOP9mo ago
No description
KenV
KenVOP9mo ago
this is an example of the donation_controller in controllers and DonationRepository in repositories
No description
No description
jamwt
jamwt9mo ago
got it, thanks. why is the controllers directory a different color in vs code? is that some special directory type?
jamwt
jamwt9mo ago
because the your type completions are indicating there are a different set of paths on this particular api object:
No description
jamwt
jamwt9mo ago
ref_controller? users_controller. etc
KenV
KenVOP9mo ago
i try move it out of the folder to convex top folder but still can't find api route
No description
jamwt
jamwt9mo ago
do you have a second, older convex folder around? that contains something called "users_controller"? b/c again, this api object seems to have that on it.
KenV
KenVOP9mo ago
the api that recognize here is there using query function i cant find any my action function
KenV
KenVOP9mo ago
No description
KenV
KenVOP9mo ago
i cant find my action function api
sshader
sshader9mo ago
Are these functions exported somewhere not in the screenshot? I don't see them exported in the screenshots you've shared so far
KenV
KenVOP9mo ago
No description
KenV
KenVOP9mo ago
but if i remove any interface its found in the api route but i have ts error
No description
KenV
KenVOP9mo ago
any suggestion?
sshader
sshader9mo ago
Can you try removing the any type annotation on your functions? Given that you're exporting your functions and they appear in the dashboard, I'd guess that at runtime you can call these, but TypeScript is just confused. The api TypeScript type works by essentially looking for all exports that match the type returned by query, mutation, and action, so the any is likely messing with that. In case you run into these TS errors without the any, https://docs.convex.dev/functions/actions#dealing-with-circular-type-inference (you might need to add a return type annotation to handler in a few places)
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment

Did you find this page helpful?