Open jkkayy opened 5 months ago
I'm also encountering the same error
The same error
@Ase020 How did you buy openAI credits When I am trying it is showing "We are unable to authenticate your payment method. Please choose a different payment method and try again." this
There are many optimizations available to reduce usage and stay within Convex's free plan limits, by adding indexes.
Check out https://docs.convex.dev/database/indexes/indexes-and-query-perf for a detailed description of why this works.
For example, to reduce usage within getPodcastByAuthorId
, you can add an index on the podcasts
table by authorId
and use withIndex
instead of .filter
.
export const getPodcastByAuthorId = query({
args: {
authorId: v.string(),
},
handler: async (ctx, args) => {
const podcasts = await ctx.db
.query("podcasts")
.withIndex("by_authorId", (q) => q.eq("authorId", args.authorId))
.collect();
const totalListeners = podcasts.reduce(
(sum, podcast) => sum + podcast.views,
0
);
return { podcasts, listeners: totalListeners };
},
});
To reduce usage within getTrendingPodcasts
you can add an index on the podcasts
table by views
and do this:
export const getTrendingPodcasts = query({
handler: async (ctx) => {
return await ctx.db.query("podcasts").withIndex("by_views").order("desc").take(8);
},
});
I am getting an error which is crashing the frontend.
Error: [CONVEX Q(podcasts:getTrendingPodcasts)] [Request ID: b3ba307126deb9c6] Server Error You have exceeded the free plan limits, so your deployments have been disabled. Please upgrade to a Pro plan or reach out to us at support@convex.dev for help.