Convex Community

CC

Convex Community

Join the Convex Discord! Explore Convex, the fullstack TypeScript platform for developers and startup founders.

Join

support-community

show-and-tell

general

self-hosted

announcements

tanstack mutation onError doesnt handle convex error properly

I expect that on the client side, i would just render the message, not the whole error stack
No description

How to handle errors with the `usePaginatedQuery()` React hook?

Greetings, all 👋 I'm brand-new to the discord community, and also in fact somewhat new to Convex (two months, and overall pleased)… So, my question: I'm using usePaginatedQuery() to load realtime chat messages powered by Convex, and am seeking guidance on error handling. I've always got an eye towards error handling which is "extra-strength" when it comes to anything involving network operations 😉 but am finding a lack of any mention in the usePaginatedQuery() docs about error handling of any kind (in fact the only in-page search result for the string "error" highlights the API reference link in the docs nav 😅 )....

getAuthUserId with tanstack userId null

When using using useQuery from @tanstack/react-query, getAuthUserId always returning null so the current userId is null

How to return a custom list with extra key-value pair(s)?

I am trying to return list from my table "riskAssessments" but with an extra key-value pair on each element to add in the value of a subquery : ```export const listWithVendorNames = query({ handler: async (ctx) => { const assessments = await ctx.db.query("riskAssessments").collect() let assessmentsWithVendorNames = [] ...

Issue with expo app and convex, and how .env variables are loaded

Is there a way to have convex read .env.development rather than the default .env.local The reason for asking is that i am using convex in a expo app where i store some production variables in a .env.production which i use for testing the app against my prod convex deployment. When i run...

Unable to pass Custom Queries to CRUD function.

I logged a ticket with all of the detail in the convex-helpers project, but thought I would share here as well: Ticket: https://github.com/get-convex/convex-helpers/issues/250#issue-2515821771 Issue: I worked on a project over the summer for a client using Convex, and have just started to pick things back up after a few months of low-to-no activity. After updating deps, I seem to have some odd TS error blocking builds & updates....

[ConvexAuth] stuck on auth loading & websocket reconnect

Hello, We are experiencing some issues with the @convex-dev/auth library it seems We are using these versions of the related packages:...

How to apply filter before pagination?

In the provided code, why are filter calls applied first to paginate the documents, and then the Predicate function is applied to those paginated documents? What I need: I want to first search the database, and then apply pagination to the filtered results. How can I modify the code to achieve this? ...

Compound index

Hello everyone, I need some help with Convex database indexing. I have a table named 'skills' and I have two separate indexes on the is_published and is_featured fields. I need to query the data based on both these fields. Initially, I thought of using a compound index, but it seems like the withIndex method doesn't allow multiple .eq() checks. Is there any way to efficiently filter by both these fields using the indexes? Any help would be greatly appreciated!

can't do 2 crons in file ?

I can't do two same crons in one crons.ts ? params are different but i want to run two crons with different params....

how to customize magic link email template?

im planning to use React Email for this but i have no idea where to plug in the code
No description

Incorrect docs for NextJS "Server-side authentication"

The implementation of getAuthToken depends on your authentication provider. app/auth.ts ``` import { auth } from "@clerk/nextjs";...

Convex Auth is not supporting Next.js RC with React 19 right?

I get this error from the @convex-dev/auth library: Attempted import error: 'createContext' is not exported from 'react' ....

Big dataset not in filter

I have asked about this topic before but there are things I can't figure out. I am setting up a structure similar to tinder. I keep the reactions of the users and the user id they reacted to in a table. My flow is working now but it is obvious that it will have problems with large data. (We can think of a scenario where 1 user has 100 thousand reactions and the total number of profiles is 1 million)....

Is Convex websockets down?

I'm not sure if it is just me and whether this is the right channel to report this, but I all my requests are taking an extremely long time to load over the typical websocket connection. I've tried this out on 3 separate apps and they are all showing the same symptoms - stuck in the loading state. getting a number of these errors from a UI that I can inspect. also for context, I reside in Singapore so am accessing it from here....
No description

How to aggregate documents (more than 16K)?

Hi, I know aggregations, joins, etc may not be the most performance queries but something the developer have no other option. How can I count all the documents of a table? Also, I need to count the documents by month, for example: All the invoices per year, per month, per week, etc. I would not like to export to elasticsearch because would make me lose the realtime capabilities....
No description

Race conditions with single use refresh tokens for Convex Auth

I'm trying to prototype refreshing Convex Auth tokens from my backend, to support server side rendering and data fetching. I'm able to do this by setting cookies instead of use local storage, but am struggling to avoid race conditions for the refresh token. There a few differen scenarious where multiple requests come it at the same time onto different servers. The servers notice the JWT is about to expire (I'm faking 10 seconds expire) and then call the signIn action with the refresh token. This often causes the user to log out because (I believe) the second refresh fails due to reusing the refresh token quickly. I've tried deduping the refresh calls, but this is not straightforward with multiple requests/servers/reloads so it's still flaky. Two questions: 1. Is it correct that the refresh token can only be used once, with no buffer in time?...

How to handle call-back in convex ?

Essentially trying to achieve: app.get("/callback", async (req, res) => { const { a, b } = req.query; }...