conradkohC
Convex Community14mo ago
5 replies
conradkoh

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
//file: convex/test.ts
const doSomething = authenticatedQuery({
  args: ...
  handler: ...
});

const authenticatedQuery = customQuery(...); //I have these methods primarily to inject the session id into the args, and apply the session id in the context for ease of use


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.
image.png
image.png
Was this page helpful?