Open Jay-Karia opened 5 months ago
To avoid this error, you can add an index on the podcasts
table by authorId
, and use it here
https://github.com/adrianhajdin/podcastr/blob/e4b647350223c45e2ebee356112158545d61473e/convex/users.ts#L31
const podcasts = await ctx.db
.query("podcasts")
.withIndex("by_authorId", (q) => q.eq("authorId", u.clerkId))
.collect();
and define the index here https://github.com/adrianhajdin/podcastr/blob/e4b647350223c45e2ebee356112158545d61473e/convex/schema.ts#L21
.index("by_authorId", ["authorId"])
Why this works: with a .filter()
, it reads the entire podcasts table for each user, but withIndex
only looks up the podcasts authored by that specific user.
Server Error Uncaught Error: Too many bytes read in a single function execution (limit: 8388608 bytes).