Convex Community

CC

Convex Community

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

Join

nextjs middleware

Currently trying to upgrade to next 15. However, when following the changelog, the middleware seem to be broken. I have updated the middleware to be identical to the example shown at https://labs.convex.dev/auth/authz/nextjs. It seems like convexAuth.isAuthenticated() always returns false and therefore continuously redirecting back to the signin page.

Calling `ctx.runQuery` from `query`

I seem to have my world shaken by Convex almost every day (in a good way)! I always thought ctx.runQuery/runMutation was only possible from actions, and that calling a query from within a query was not possible, but that regular TS helper functions should be employed (e.g. as @erquhart mentions here https://discord.com/channels/1019350475847499849/1216003221445939330/1216033039247867984). I just found out that it is indeed possible by just using ctx.runQuery. That comes with this warning/info: often you can call the query's function directly? Is this what you mean/propose?: ...

Acceptable circular reference counts?

Currently within convex i have 20 circular references with 14 that appear with a _generated/api.d.ts (34 total).. Do the references related to api.d.ts have the potential to cause problems? I still have some refactor ptsd after having to redesign a lot to get it down from over 60 in october. Its not easy to tell where the tipping point is until stuff breaks and it can get very weird. Its also been keeping me from redesigning the final execution part of our event system for easier use. ...

Force logout user / invalidate JWT token

Hello, is it possible to force logout user / invalidate JWT Token on the backend side to make player need to login again?

Making a Open Source Convex app, for those who dont want to write any code, and just want a website.

For the past month, I've been working on an app called Mathalogical (just a random name that doesn't really mean anything). It’s designed for people writing papers on math. Mathalogical is a blog/self-noting, self-hosting website where you don’t need to write any code. With simple steps to guide you through the setup process, you can start writing papers in no time—keeping some private or publishing them to the internet. I found Convex very easy to use and far better than other backend services. However, there’s an issue with website functionality related to hosting using the generatekeys.mjs script from the Convex auth guide for manual setup. It seems that you have to run the code on your local device, which requires installing Node.js. This step feels unnecessary for users who just want to write in the editor and have no interest in development tools. I was hoping we could find a solution to this. Thank you!...
No description

Accessing client IP address in a query/mutation

Good day. Any help would be appreciated, as I am fairly new to Convex. Is there a way to expose HTTP headers, such as for obtaining the IP address in the example below? Or is an httpAction required for this use case? ```TypeScript const registerClient = mutation({ args: { userAgent: v.string() },...

local dev environment?

Hello. I've been using Firebase for years and one of the things I love most about it is the local emulator suite which also has a local GUI you can launch in a browser. Is there any equivalent to that with Convex? I just learned about Convex and am curious to give it a try.

Database Structure Help

Hey I need a little help trying to structure my database. I'm making a tenant management app. There are multiple managers and each manager can create multiple properties and add one tenant per property. There is a page that allows the manager to view all his tenants but for that to work I need to get all their properties and then get all the tenants under each property It feels really tedieous and I was wondering if there is a smarter more proper way to do this I feel like the tenant should also have a manager_id field but I don't know if that's how it should be done...

convex.cloud requests blocked by malwarebytes

I just had a usertest session of my app and the user reported that links to my convex.cloud deployment were blocked by malwarebytes so we couldn't do any testing. Has this happened before? Do we have any idea what could cause this?

Getting the user id

I am following a tutorial where they use
const userId = await auth.getUserId(ctx)
const userId = await auth.getUserId(ctx)
This is apprently deprecated now, so looking at the Convex code nase in my IDE I see I have to use
const userId = await getAuthUserId(ctx);
const userId = await getAuthUserId(ctx);
...

What to put for auth.config.ts domain?

If the url for the jwks.json is https://auth.privy.io/api/v1/apps/<app_id>/jwks.json, what should be the value of domain in auth.config.ts?

debouncing

hey! i have a text input and based on its value i need to query the database? right now as soon as i type something it starts to query and is being super reactive. which is good, but at the same time "isn't it putting too much pressure on db"? and hence increasing the total costs for me? should i implement a debouncing on the client side for that? if yes -- then whats is the best way to do that? because its returning immediately results for previous debounced value -- which is wrong and staying like that for some time until the next debounced value appears...

About receiving useQuery events

I have a question about useQuery. (This is a translation, so the wording may be awkward). I'm developing a chat room. I'll give you an example to help you understand. I've created the following getMessages function to query messages per chat room. export const getMessages = query({...

Convex Auth + Google + Custom Domain

Hey Convex team, I've configured Convex Auth with Google and it works great, except my Convex .site domain is being used even though I have a custom HTTP Actions domain configured in both Convex and Google Auth Platform. The Convex URL shows up in the Google sign-in page, which makes it look untrustworthy to my customer (see screenshot) -- I need this page to display my custom subdomain instead. I tried editing the domain value in my auth.config.ts, but this doesn't help -- it seems process.env.CONVEX_SITE_URL is hardcoded in several places....
No description

Clerk integration call functions infinitely - need help

Using expo@52.0.17, convex@1.17.3 and @clerk/clerk-expo@2.4.2, currently working in a turborepo project with yarn I have configured the clerk integration according to the documentation, my _layout.tsx : ```typescript import { ClerkProvider, useAuth, ClerkLoaded } from "@clerk/clerk-expo"; import { ConvexProviderWithClerk } from "convex/react-clerk";...
No description

convex.json schema?

Hey there, I was wondering if there was a JSON schema available for the convex.json config file by chance. Does this exist? Couldn't find anything on the Convex search.

I currently run a cron job every 20 sec but its using bandwidth a lot how can i reduce the bandwidth

My cron job currently runs every 20 sec. It scrapes data from a site and inserts into the db. The db has 300 rows and 12 columns which is updated every 20 sec. My ideal situation is to be able to run the cron every 10 sec or even lower but seeing that i am doing something clearly wrong how can i optimise this behavior. I liked using convex because of the real time changes that can be seen in the UI when i change the db data after cron job updates it. Any help is appreciated.
No description

.paginate combined with .withIndex is causing an error

let say I have two tables in my scheme that represents a user that lives in a city and posts that are made in a city. All the code below could be better arranged, but this is for the simplicity of the example: ```TS const userTable = defineTable({...

Convex Auth + Tamagui (Monorepo)

Hey, I added convex to my nextjs app so far, but trying to use Auth signIn Im getting http://localhost:3000/api/auth 404 Not found error. What am I doing wrong?
No description