Convex Community

CC

Convex Community

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

Join

Feature Request: return the number the page is on in `.paginate()`

I've hit a use case where I need to know the total page number, Previous page number, and nextPage number, is there something I might be missing with results being returned from the query?...

Fetching another document's data via id in query

schema.ts ```ts import { authTables } from "@convex-dev/auth/server"; import { defineSchema, defineTable } from "convex/server"; import { v } from "convex/values";...

How to get the URL of an image in the storage by its id?

I have tried the http method but obviously I'm doing something wrong. convex/http.ts ```ts import { httpRouter } from "convex/server";...

`npx convex dev` always adds `.env.local` to `.gitignore`?

Hey team! I'm working on an open source repo that requires contributors to initialize Convex on their local machines. I've noticed a few contributors push code that adds .env.local at the bottom of .gitignore, even though it's already listed above. I think this is being added automatically during the initialization process. Is there a way to disable this, or to improve the .gitignore pattern matching so it doesn't get added?...
No description

Hitting error "found wrong number of app bundles" in dev CLI

Hi there! I am hitting an error in which whenever I add a convex.config.ts file to install components, I get a "found wrong number of app bundles" in the CLI. I have tried searching the docs and github but haven't managed to find anything. This is pretty much all that is in my convex.config.ts file right now. I am using remix in the same repo if that is of any significance. Any help would be appreciated! šŸ˜€ Thank you ```ts import { defineApp } from "convex/server"; ...

Convex Auth JWT Subject

Hey guys, I noticed that every time I signOut and then signIn again, the sub field in my JWT token changes The first part is remaining constant which is the userId but then the second part is changing. For example: Initialy when I logged in the sub field in decoded JWT token was k172bx4p67v9qdhtac9n508ckn76vs10|jn73yr27ask6fsjjs8mzr4xhm576tczh...

Deleting Users from Backend Function that are Synced with Clerk

I have a users table that is updated by Clerk sending webhooks with the users over to convex. Now I want to implement a feature where admins on my site can delete users. However, I am running into an error when I run npx convex dev as seen in the screenshot. This is my backend function that is triggering the error, more specifically, when I imported clerkClient. ```tsx import { clerkClient } from "@clerk/nextjs/server";...
Solution:
@Tom thank you tom! I ended up splitting the code into a mutation and an action. That way I could use the third party call inside of the backend!
No description

Resize function window

Playing around in convex, i found out that if i run an action/query/mutation that yields a very long output, the bottom bar expands to fill almost the whole view, resulting in me not being able to see data in my tables. Am I doing something wrong, or is it unexpected behaviour?
No description

Architecture of larger convex apps.

Hey guys, I'm a solo developer working with Convex and some of my apps are getting bigger with complex business logic. I wanted a cleaner architecture approach but don't want to over-engineer since I'm working solo. I asked Claude for suggesting and it gave me the ones in the image, but I'm not experienced enough to tell if they are good or not. Would love to hear from seasoned devs about:...
No description

TS type error: Property 'messages' does not exist on type '{}'.ts(2339) (internal.messages)

I am roughly following https://stack.convex.dev/full-stack-chatgpt-app this tutorial. And got this error on my action. I have "messages.ts" file and "send" mutation. Looks like "internal" inside "_generated/api.d.ts" doesn't have any property. Any idea what could be wrong? ...
No description

Http referrers in google console via convex actions

Hey all, I am currently interacting with a google api (timezone api) and am configuring the website restrictions in the google console. My system environment variable referenced within the action is logging the expected value, accessed at process.env.CONVEX_CLOUD_URL. I've followed the guidelines in the google documentation to allow subdomains of convex.cloud to call the api from the server deployments, and have also added a referer to the headers of the fetch request made from the action. ...

Debug Production

Hello, I have run into a situation where a user has a problem / bug in production environment. Is there a way to copy production environment into development? what would be the best way to login as this user and to simulate his connection?...

Programmatically force convex to reload and re authenticate ?

Is there a way to force the Convex auth provider to refresh? Iā€™m almost done building a full-stack monorepo using Next.js and Capacitor, leveraging the full capabilities of Convex, including authentication. Everything works fine until the iOS WebView gets killed in the background to save memory. As a result, when the user returns to the app after a period of inactivity, they end up in a stale state and are stuck on a loading screen. The only way to resolve this is by clearing the app from the ba...

Accessing database in an action

I'm hoping to better understand why ActionCtx does not expose db. This forces me to write much longer code like the first below, instead of the second. ```TypeScript export const set = internalAction({ args: { key: v.string() }, handler: async (ctx, { key }) => {...

unique() query returned more than one result

Hello Support, Ive a question about our database. I get the error: "Uncaught Error: unique() query returned more than one result" if I have more than one document with an empty string. I know its unique but I also cant set more than one to unset. What should I do if I dont want to safe a value and want to make the value unset?...

Should I use `users` table or `profiles`?

Should I use users table from Convex Auth for storing additional user data, or should I better create profiles table and store it there, not touching the users table? Which one is considered a best practice for Convex Auth?

[Backup & restore]: Force overwrite

Would it be possible to add this to the web interface restore? Maybe this could be made an option only for dev environments to avoid doing something nasty. We back up our prod deployment, and sometimes I would like to overwrite my dev deployment with such a backup, but must manually clear all tables first to avoid this error:
Hit an error while importing: _id p1703ysnrnkv5skgsshk2zaa0h76ch4j cannot be imported into 'subscription' because it came from a different deployment and conflict with preexisting tables in this deployment. Try deleting preexisting tables or importing into an empty deployment.
Hit an error while importing: _id p1703ysnrnkv5skgsshk2zaa0h76ch4j cannot be imported into 'subscription' because it came from a different deployment and conflict with preexisting tables in this deployment. Try deleting preexisting tables or importing into an empty deployment.
...

Zod

https://stack.convex.dev/typescript-zod-function-validation is it a good idea to use Zod for validation - I just started using tanstack forms and have used zod a little and liked it. any thoughts on using it as described in this article...

Intergrate Github OAuth but cannot create new User

hello every one I set up table like this (default) import { defineSchema } from "convex/server"; import { authTables } from "@convex-dev/auth/server"; ...

Can anyone give me the correct build command override for vercel?

I have used this npx convex deploy --cmd='npm run build' and npx convex deploy && npm run build getting error in both .
No description
Next