Eva
CCConvex Community
•Created by Eva on 12/21/2024 in #support-community
`npx convex dev` always adds `.env.local` to `.gitignore`?
13 replies
CCConvex Community
•Created by Eva on 12/9/2024 in #support-community
Testing `withIdentity` in `convex-test`
Hello! I've created a custom mutation for
userMutation
and a custom query for userQuery
which use getAuthUserId
to pass along the current userId and verify that a user is authenticated. I then use these custom mutations and queries whenever I want one of my Convex functions to run with authentication for the current user.
I want to write tests for these queries and mutations, and I understand I can use t.withIdentity
to mock a user account. How can I get the mock id
from the withIdentity
user? When I try accessing it, I get a typescript error that the mocked user's id
doesn't exist on Id<"users">
.7 replies
CCConvex Community
•Created by Eva on 11/30/2024 in #support-community
React Testing Library + Vitest + Convex Test?
Can
convex-test
be used with Vitest and React Testing Library during unit tests for components?
Docs for convex-test
point to examples of testing queries and mutations directly (from within the backend convex directory). Can it also be used to mock component tests which indirectly trigger Convex queries and mutations? Are there best practice examples of this I can see?16 replies
CCConvex Community
•Created by Eva on 11/15/2024 in #support-community
Running Convex locally while deploying to hosted plan
I'm building an open source project on top of Convex and I'd like to accept code contributions from others. Afaik the only way to enable this right now is to add every contributor as a paid seat on my Convex plan, and although I wish I had the project income to do that, we currently make $0 in revenue. Is it possible to enable people to spin up a local backend for Convex while still relying on the hosted/paid plan for production data and management?
8 replies
CCConvex Community
•Created by Eva on 9/21/2024 in #support-community
Querying for dev/preview/prod status within code?
Does Convex offer a way to query for whether the app is dev, preview, or prod? I can use
process.env.NODE_ENV
to check for prod or dev but it registers preview deploys as production. (This is just the way NODE_ENV works so I’m wondering if there is an equivalent CONVEX_ENV of sorts)6 replies
CCConvex Community
•Created by Eva on 9/5/2024 in #support-community
Setting up a custom domain
I'm having trouble following the docs to understand the process of setting up a custom domain for my Convex site. I'm using Cloudflare Pages, and the build and deploy part are working, but the app displays a white page with a console error reading:
- In my
.env.local
, VITE_CONVEX_URL
is set to a URL ending in .convex.cloud
. Do I update this to my production URL? Do I also need to add it to .env
?
- Are there settings in the Convex dashboard I need to modify?
- In the Convex dashboard, for Development deploys, in Settings > Environment Variables, I have a SITE_URL
set to http://localhost:5173
. In Production deploys there is no SITE_URL
defined. Do I need to add SITE_URL
to Production Environment Variables with my production URL?
- How do I handle preview deploys for Convex with Cloudflare Pages?
I've read through the Custom Domains & Hosting docs page but I'm still unclear on the steps. Thanks for any help :)28 replies
CCConvex Community
•Created by Eva on 9/1/2024 in #support-community
`convex-test` could not find the "_generated" directory
11 replies
CCConvex Community
•Created by Eva on 9/1/2024 in #support-community
Deleting users with Convex Auth
What's the best practice for deleting users when using Convex Auth? There aren't any examples in the docs, and removing only the row on the
users
table throws an error if you try to sign up with the same email.
18 replies
CCConvex Community
•Created by Eva on 8/31/2024 in #support-community
Redirecting unauthenticated users? Convex Auth + TanStack Router
Hi! Hopefully this is an easy one, but I'm new to both Convex, TanStack, and this is my first time ever setting up authentication! So trying to follow best pratices and reading but getting a little lost.
I have a
/settings
route and I want to redirect unauthenticated users away to /signin
. I found the docs in TanStack Router for how to set up a redirect on beforeLoad
but I don't know how to check for isAuthenticated()
using Convex Auth. Help?
https://tanstack.com/router/latest/docs/framework/react/guide/authenticated-routes#redirecting5 replies
CCConvex Community
•Created by Eva on 8/21/2024 in #support-community
Using non-primary GitHub email when signing up for Convex
3 replies