Convex Community

CC

Convex Community

Join the Convex Discord! Explore Convex, the open-source reactive database for app developers.

Join

support-community

show-and-tell

general

self-hosted

announcements

Default env vars aren't being used on new preview deployments

I'm using Next.js with Convex and Better Auth, deploying through Vercel. Currently trying to set up a preview deployment. I've set up a bunch of default env vars in the Convex project settings to be used on preview deployments, but when I deploy from Vercel, the convex build push fails because it's missing some env vars, and when I look at the env vars for the new convex preview deployment, it doesn't have any env vars set. Is there anything else I need to set to get the default env vars to show up in new preview deployments? I've scoured the docs / discord but haven't seen anything else....

Error throw after deleting entity in React Native

I'm building a React Native app with Expo router and my CRUD screens for entities are more or less like so: List all entities screen -> View Entity screen -> Edit screen -> Delete button. after calling the delete mutation, which in convex uses the .delete method, I use the router to dismiss back to the List screen but my "get(id)" query throws. I believe because Convex is still listening and the screen might be mounted somewhere ...

Line endings on _generated code

I had a convex project and added someone else to the project. When they ran the swagger codegen it created the same files with the opposite line endings than I had. I was on linux and they were on Windows. I only care because it creates a diff in git

read data is toomuch

hi so we are using convex for database storage - with just one person using it - my daily read and write database is coming to be 25 gb with read having most of the portions - and it hs only text that we storing in database one user doing calls to retrieve data from database - it feels very unusal that if things like apple notes consumes data in kb's but on convex teh read data is coming in gb for text files - any help would be appreciated?

Exporting component-specific data from production to development

Hi, right now I am using ConvexHttpClient to query specific documents from production and subsequently use npx convex import to import them into my development deployment. I would also like to copy over specific documents like this for data stored inside non-app components. Is it possible to do this right now? I do see that npx convex import has an option to specify a --component path, but I don't know if it's possible to programmatically query specific documents from a non-app component. I know it's possible to export all data using npx convex export, but I'd like to only export specific documents since exporting the full production database can take a long time....

withSearchIndex does not return results when running tests, but does in production.

Assume you have the following query:
await db.query("tasks").withSearchIndex("search_name", (q) => q.search("name", taskName)).paginate(paginationOpts)
await db.query("tasks").withSearchIndex("search_name", (q) => q.search("name", taskName)).paginate(paginationOpts)
...

Environment Variables Not Loading During Testing in Convex Application

I'm currently working on adding automated tests to my Convex application. While everything functions correctly in the production environment, I'm encountering an issue during testing: environment variables are not being loaded as expected. My backend functions rely on environment variables (e.g., API keys, secrets, config values), and these are accessible and work fine when deployed. However, when I run tests using tools like convex-test and Vitest, it seems that the test environment doesn't automatically load or recognize the .env variables. This is blocking me from properly testing critical parts of the application, especially those dependent on third-party services or configuration....

Intermittent 404s with Convex Auth + NextJS

I'm using Convex Auth with NextJS but getting occasional Vercel 404s when navigating to "/" after not having used my app in a while. The 404 goes away when I refresh and doesn't happen when the app is "warm." I thought it was a NextJS issue at first but this random StackOverflow poster ran into the same issue with Convex + NextJS, which is suspicious. It's making me believe it's something about how Convex Auth interacts with NextJS. My setup is the same as this template: I have a ConvexAuthNextjsServerProvider with a ConvexAuthNextjsProvider inside. And then use convexAuth.isAuthenticated() + nextjsMiddlewareRedirect to send users to the right location based on whether they're signed in or not. ...

Setting up convex with better-auth

I trying to setup with better-t-stack a new project with convex and add better-auth, after adding everything according to the better-auth/convex docs I getting an error that it can not resolve the packages.
No description

OpenAI Agent and Persistent-text-streaming with tool calls

I'm building a chat application using Convex with streaming responses. I have a streamChat HTTP action that currently works with a simple agent, but I need to integrate a more complex agent (unified_agent) that requires access to tools running in Node.js runtime (specifically Slack SDK tools). Current Setup: . streamChat is an HTTP action in Convex . I have a unified_agent that needs to use Slack tools requiring Node.js runtime . The agent needs to access conversation history and maintain context...
No description

How do I delete a local project?

I have created multiple tests local project but I am not sure how to delete them. Is there any CLI command I can run?

Paginatedquery rerunning

Hi, I can't seem to figure out why some paginated queries are being reran (using convex/react), and others aren't, even when the data is not changing at all. here's an example, I have one function called getHotPosts, which the query for looks like this const results = await ctx.db .query("threads")...

Using custom query with typescript filtering and pagination. Performance and limitation issues.

Hello together, I have a question regarding quering with streams and .filterWith. We have this table structure ```ts...

Can't login to pro account

I have a convex account micah@firstbuild.dev associated with a github account that has migrated to an organiization account. I can no longer log into to my pro account under the email. It redirects me to another account associated with micah@sircularity.ii

Integrating stripe connect into convex

My app idea is to be able to go to a user, and if they have signed their financial details up through stripe, I can donate to them. The user gets a percentage as does the platform. The question is how would i go about approaching this with convex?

No auto update of instructions for AI agent components

Whenever I update the "instructions" field when defining an agent, I have to rerun my development servers. Why exactly is that? Even though the Convex functions are resynced and I see "Convex functions ready! (7.77s)", is this expected behavior?...

Convex with TanStack Start

I want to use TanStack Start with Convex in a monorepo, but I have a few doubts. While following the Convex guide for TanStack Start, I didn’t quite understand why it uses useSuspenseQuery. Can’t we just use useQuery and useMutation with Convex? Is it necessary to use useSuspenseQuery? Also, is using Convex with TanStack Start a good idea overall? Will I still be able to use TanStack Start to its full potential?...

zCustomQuery and use of zid + Id<"tableName" returns type errors: is incompatible with index

anyone able to help with this? using zCustomQuery causes issues when defining zid("tableName") in the validator. fyi: using convex ents, but that doesn't appear related....

When I use a paginated query, is there a quick way to know the total count?

I am querying a large dataset, and I have filters based on many fields, some of them are user generated. This means that there is no way to cache the filter result, because there could be an infinite amount of combinations. Right now I need to use
.collect()
.collect()
and count all the documents. Is there a more efficient way of doing this? ...

Upgrading AI SDK to v5 in Convex RAG component

I am trying to do the following in my rag.ts:
export const rag = new RAG(components.rag, {
textEmbeddingModel: google.textEmbeddingModel("gemini-embedding-001"),
embeddingDimension: 2048,
});
export const rag = new RAG(components.rag, {
textEmbeddingModel: google.textEmbeddingModel("gemini-embedding-001"),
embeddingDimension: 2048,
});
...