adrianhajdin / podcastr

https://podcastr-23zf.vercel.app
463 stars 94 forks source link

Error: You have exceeded the free plan limits #5

Open jkkayy opened 1 month ago

jkkayy commented 1 month ago

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.

image

Ase020 commented 1 month ago

I'm also encountering the same error

ReligiouslyAbusedinTokyo commented 1 month ago

I am not be able to get a free tier ??? again???

wendreslucas commented 3 weeks ago

The same error

akashkumar23495 commented 3 weeks ago

@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

ldanilek commented 3 weeks ago

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);
  },
});