Ajay
Ajay6d ago

Polar components not found

Hi, I've recently refactored my repo. Functions are now organized like this:
packages/convex
├── _generated
├── api.d.ts
├── api.js
├── dataModel.d.ts
├── server.d.ts
└── server.js
├── analytics
├── mutations.ts
└── queries.ts
├── auth.config.ts
├── convex.config.ts
├── http.ts
├── package.json
├── payments
├── actions.ts
├── mutations.ts
├── queries.ts
└── utils.ts
├── polar.ts
├── preferences
├── mutations.ts
└── queries.ts
├── schema.ts
├── tsconfig.json
└── users
├── mutations.ts
└── queries.ts
packages/convex
├── _generated
├── api.d.ts
├── api.js
├── dataModel.d.ts
├── server.d.ts
└── server.js
├── analytics
├── mutations.ts
└── queries.ts
├── auth.config.ts
├── convex.config.ts
├── http.ts
├── package.json
├── payments
├── actions.ts
├── mutations.ts
├── queries.ts
└── utils.ts
├── polar.ts
├── preferences
├── mutations.ts
└── queries.ts
├── schema.ts
├── tsconfig.json
└── users
├── mutations.ts
└── queries.ts
These are successfully represented on Convex. Most are typed. Problem is, for polar.ts I can't seem to see these functions in a type safe way in my web application. In particular I'm looking for Registered functions like listAllProducts() Previously when there were no folders and there was a flat structure I was able to see listAllProducts() any ideas what happened here?
No description
No description
2 Replies
Convex Bot
Convex Bot6d ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Ajay
AjayOP6d ago
The polar.ts file is as follows:
import { Polar } from "@convex-dev/polar";
import { components, internal } from "./_generated/api";
import type { Id } from "./_generated/dataModel";

export const polar = new Polar(components.polar, {
getUserInfo: async (ctx): Promise<{ userId: Id<"users">; email: string }> => {
const user = await ctx.runQuery(internal.users.queries.getCurrentUser);
return {
userId: user._id,
email: user.email,
};
},
server: process.env.POLAR_SERVER as "production" | "sandbox" | undefined,
});

export const {
changeCurrentSubscription,
cancelCurrentSubscription,
getConfiguredProducts,
listAllProducts,
generateCheckoutLink,
generateCustomerPortalUrl,
} = polar.api();
import { Polar } from "@convex-dev/polar";
import { components, internal } from "./_generated/api";
import type { Id } from "./_generated/dataModel";

export const polar = new Polar(components.polar, {
getUserInfo: async (ctx): Promise<{ userId: Id<"users">; email: string }> => {
const user = await ctx.runQuery(internal.users.queries.getCurrentUser);
return {
userId: user._id,
email: user.email,
};
},
server: process.env.POLAR_SERVER as "production" | "sandbox" | undefined,
});

export const {
changeCurrentSubscription,
cancelCurrentSubscription,
getConfiguredProducts,
listAllProducts,
generateCheckoutLink,
generateCustomerPortalUrl,
} = polar.api();
So the directive just isn't noticing the exported functions.

Did you find this page helpful?