Lyonel Pierce
Lyonel Pierce
CCConvex Community
Created by Lyonel Pierce on 5/23/2025 in #support-community
Query returns empty in production Next.js
I have a Next.js app integrated with Clerk and deployed on vercel and a query used on server and client side. export const getLines = query({ args: { document_id: v.id("documents"), }, handler: async (ctx, args) => { const lines = await ctx.db .query("lines") .withIndex("by_document_id", (q) => q.eq("document_id", args.document_id)) .collect(); return lines; }, }); const data = await preloadQuery(api.lines.getLines, { document_id: id as Id<"documents">, }); const preloadedLines = usePreloadedQuery(lines); This works perfect on local development, but on production returns empty even if there are documents on the table (even after refresh). This does not happens all the time, there are times when the query is not empty. I would say 70/30 being empty 70%.
7 replies