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

stop from running again

I have a data processing function that kicks a bunch of other function off with runafter is there a way to see if these functions are still running programatically I'd like to stop the batch from being kicked off again if these functions are still running in the background...

How to re-organize api structure?

It's neat that Convex automatically structures the api object according to your folders, files, and function names, but on a larger project it becomes a bit impractical. For example, I have convex/users/fetchCurrentUser.ts with a function in there called, of course, fetchCurrentUser(). However, in order to consume this, I have to use:
const user = useQuery(api.users.fetchCurrentUser.fetchCurrentUser);
const user = useQuery(api.users.fetchCurrentUser.fetchCurrentUser);
...

optimistic delete rollback

I'm prototyping a feature where I can add and remove users to / from a group (called channel). Removal has constraints, removing the last ADMIN is disallowed. When trying to remove the last admin the mutation throws a Convex Error and the frontend displays a toast informing the user. When removing optimistically, the constraint is not enforced and the user is removed from the localstore. I'd expect that when the mutations throws, the optimistic update is rolled back but apparently this doesn't happen. Is there a way to debug this? Can I somehow inspec the local store to see if this is a UI problem?...

Need some suggestions about the DX

I'm probably in the minority here. But the DX for convex isn't awesome for bigger projects.
I'm coming from prisma and being able to do something like: ```...

slow queries (using indexes)

I'm experiencing slow queries (I only use .withIndex() queries) and mutations The only thing I can think of is that this might be due to the location of convex servers that from what I can gather are located US east coast. Are you planning to have europe servers as well? At the moment I'm working with optimistic updates but in general I feel performance is a bit sluggish...
No description

useQuery giving undefined while useSuspenseQuery gives results

Using TanStack Start. Here is the query. `export const getDeviceTypes = query({ args: {}, handler: async (ctx) => {...

SMS auth with Convex

Hi guys, building out an Expo RN app and I have it all setup with Clerk right now for SMS authentication. Saw Clerk's pricing based on MAUs and was wondering if Convex Auth priced similarly. My main way of authenticating users right now would be based on SMS verification codes (but will likely also support Google/Apple down the line). I know the Convex team recommends third-party auth solutions but does anyone has experience using Convex Auth in a prod app? Would love to hear from the community!...

How to have multiple schemas

I've seen this, but I don't think it's what I want: https://docs.convex.dev/production/multiple-repos I saw somewhere and now I can't find it. The ability to have multiple ConvexProviders in react because they were going to different code generated endpoints....
No description

What is the recommended method for implementing role-based route protection within Next.js?

What is the recommended method for implementing role-based route protection within Next.js middleware? I am able to protect routes using convexAuth.isAuthenticated, but how do I extend this to protect routes based on 'read', 'write', and 'admin' roles?

Convex Auth: How to add custom data to signIn() (or up)

Hello all, I'm trying to add additional fields to my sign up form which will be added to the users table. But I can't figure out how to pass them onward. Adding them to the FormData object passed to signIn() doesn't seem to work. How can one add these arbitrary fields (such as username)? I could also make it optional, but it shouldn't be, every account should have a username. So I'd prefer to set it via the sign up process. Any help much appreciated here. Also, would be happy to make a PR improving the documentation once I figure out how it's done. The documentation states:...

Recommended MCP Repo for Convex

I'm just getting into using MCPs with Cursor/Windsurf. Any recommended MCP repos for Convex?

CONVEX_DEPLOY_KEY

hi , I am a one-man team, doing my first Convex / Vercel deployment . I'm using a free plan , so I cannot use a preview deploy key like preview:xx-xxx...

Error when trying to run convex dev

I'm running into this error when running npx convex dev, is there soemthing i'm missing? Error fetching GET https://provision.convex.dev/api/deployment///<deployment_name>.convex.cloud/ 404 not found. I have the project on convex so I'm curious what i'm missing...

Firebase Auth (Native iOS) + Convex auth

Hi 👋 I’m trying to use convex on my app but I use firebase auth and I’d like to link it to convex auth and having issues on that. Auth is pretty new to me so I’d like to know if you have resources, templates or any tips at all on how to do this link....

Convex schema is not enforced properly

[CONVEX M(orders:setOrderPaid)] [LOG] 'Received offer ID:' 'jn7d950h4v4zdnktjazswr4dnx7at5zv' [handleSuccessfulPayment] Error: { error: '[Request ID: aeb2fb84dd5d9e4d] Server Error\n' + 'Uncaught ConvexError: Invalid offer ID: No matching offer found\n' +...

runafter vs wrapper-action

Hi there, I'm wondering what is the suggested approach for the following scenario: an API endpoint that needs to perform a mutation, (optionally retrieve some data,) and the perform an operation over the network, like an httpcall. At the moment I have two different cases in which I'm adopting two different strategies: - I'm sending emails after storing an invitation record in convex using scheduler.runAfer(0, internal.emails.sendemail) from whitin the mutation that stores the invitation record - I'm sending push notification after storing a message in convex. I have a convex action that wraps (1) the mutation that stores the message; (2) the query to retrieve the push subscriptions; (3) the action to send the notifications. ...

Getting all organization users by org id from clerk

hi, guys. Newby here. I have come here to ask for help. I am currently trying to get all clerk users of the same organization authenticated user is part of. Can anyone help me understand how I can achieve it? Is it a good place to ask such a question? My stack is convex/clerk/nextjs

Advice re: schema design for user-specific role-based properties

I'd love some help brainstorming a solution to an app problem. I'm building a staff dashboard app for work. Users of this app will each have one or more assigned roles. I've got both a users table and a roles table, with the relationship between them already established. No issues there. For some (but not all) roles, there will be custom settings that are exclusive to the role. For example, with the Salesperson role there's a default commission percentage for all salespeople, but an individual salesperson might have a commission that overrides that default. While I could create something like a commission field directly on the users table to store this value, I really don't like to have fields that are only needed in limited use cases. The commission override is just one example of a role-specific setting, and there could be a lot more over time, so I'm trying to think of a more efficient way to save such settings without creating tons of limited-use fields....

Convex Auth

when convex auth will support svelte/vue/etc.? how can i authorize users in my svelte (vite) app now?...

how do I upload bigger video of 10-20 minutes on convex in live as I am filming it in OBS

Is there any simple way to implement this kind of setup with convex?