customQuery methods not findable from other package
I have a project using yarn workspaces, with the following format
- apps/webapp - my remix frontend
- services/backend - my convex backend
I find that the api object has missing properties (in some contexts) when I export a method like
In my backend, I can see the property
api.test.doSomething
(refer to screenshot 2). but when I go to the client and it imports the same file (albeit from a different package), the api.test
does not even exist (refer to screenshot 1).
1. When I replace authenticatedQuery
with query
, the file starts showing up, but other methods are still missing.
2. I just upgraded for an old project 1.12.x to 1.17.x - so I suppose much has changed
Is there any recommendation how I can extend the queries without writing fragile code that breaks with every update (feels like I'm doing something wrong)? I feel like this particular logic breaks every time I upgrade convex.3 Replies
Hmm that's strange. I've seen folks have issues like this when aliasing the convex directory (someone had a similar issue recently with tsconfig alias), not sure why though. Have you tried restarting the TS server in vs code since you updated convex?
This can happen when multiple versions of convex-helpers or convex are being used, yeah suggest making sure these all match. If e.g. convex-helpers is using a different copy of the convex library this would happen.
@erquhart
Have you tried restarting the TS server in vs code since you updated convex?I have! first thing I usually do when there are type errors in the IDE 👍🏼
someone had a similar issue recently with tsconfig aliasyeah same! I actually moved away from aliases altogether in a convex project because it isn't the easiest to configure. actually any pro tips here on how to structure the project? I find the the convex folder has its own tsconfig, but unfortunately does not allow me to put all my code in there (e.g. for other util functions) so I end up having to put stuff in a src directory and have another tsconfig. am I doing something wrong?
I've seen folks have issues like this when aliasing the convex directoryalso in my case I am not aliasing the directory, but rather using workspaces (so the package name @workspace/backend is actually the package name. the rest gets resolved via module resolution. @ballingt
This can happen when multiple versions of convex-helpers or convex are being used, yeah suggest making sure these all match.mm I just tried updating convex-helpers and convex-test but doesn't seem to work.. here's what I tried that doesn't seem to be working - convex @ 1.17.x - convex-helpers @ 0.1.65 I also tried to refer to convex-helpers and saw it was referencing 1.14.x and I tried downgrading - but doesn't seem to work. I managed to solve this problem. Some of these strange issues were solved by ensuring that none of the convex packages were hoisted. aka - convex, convex-helpers, convex-test I don't know the inner workings for why this should be the case, but this solved it for me. In yarn, the config looks like this