sshader
sshader
CCConvex Community
Created by David Alonso on 12/14/2024 in #support-community
Connect to multiple projects from the same nextjs app
(it has type safety that the args + return values match up with the api.foo.bar function path you give it, but does not protect against passing in a api for the wrong Convex deployment, e.g. clientA.query(apiB.some.query, ...) would compile but fail at runtime)
33 replies
CCConvex Community
Created by Luke on 12/15/2024 in #support-community
convex.json schema?
It's documented in english here: https://docs.convex.dev/production/project-configuration#convexjson The one in the gist looks mostly correct (nice work!) but includes some properties that have been deprecated for a while. We can probably make an official one -- what's the use case here? Better editor support when editing the convex.json file?
6 replies
CCConvex Community
Created by Pushpaje on 12/14/2024 in #support-community
How can we collaborate accross diffrent repos
Have you seen https://docs.convex.dev/production/multiple-repos ? Not sure if it's what you're looking for but potentially related
3 replies
CCConvex Community
Created by THEO on 12/16/2024 in #support-community
Clerk integration call functions infinitely - need help
Does the problem happen on Convex 1.17.2 (or any older version)? Per the changelog 1.17.3 includes a change in the Convex library around the memoization of clerk's getToken function, but we perhaps didn't account for clerk-expo here
12 replies
CCConvex Community
Created by Foressi on 12/16/2024 in #support-community
About receiving useQuery events
To add slightly more info -- we'll re-execute queries when any of the underlying data changes (so in the case of using a .collect, when any document in that table changes), but only send a new query result to the client if the result has changed -- so a client loading the query for room B will not receive query results when messages are added for room A, but the query will re-execute (it'll just have the same result so we won't send an update to the client) But yeah, this is a pretty perfect use case for an index 🙂
13 replies
CCConvex Community
Created by Doogibo on 12/13/2024 in #support-community
VERCEL_URL - dynamic Convex env
($VERCEL_GIT_COMMIT_REF is the default name we use for preview deployments running in vercel, I think npx convex env might try by default to set things on a personal dev deployment but get confused when running in Vercel)
26 replies
CCConvex Community
Created by Doogibo on 12/13/2024 in #support-community
VERCEL_URL - dynamic Convex env
Chiming in since it sounds like you're trying to set a convex env variable on a preview deployment -- npx convex env set --preview-name $VERCEL_GIT_COMMIT_REF foo bar might be what you're looking for
26 replies
CCConvex Community
Created by CabalDAO on 11/1/2024 in #support-community
Errors importing dayjs plugins
(https://httptoolkit.com/will-it-cors/ is also a pretty good resource)
23 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
https://typescript-eslint.io/rules/no-floating-promises/ is pretty good (I forget to await my promises all the time without it)
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
Lol glad you're unblocked!
34 replies
CCConvex Community
Created by entropy on 12/11/2024 in #support-community
Next build error when ran in github action
what about setting NEXT_PUBLIC_CONVEX_URL explicitly in CI (just to rule out something fishy with pulling in env vars from elsewhere) I'm also kind of surprised that a build step would be hitting this error, since that looks like a runtime error. What does your build command look like? (Mine is just next build)
8 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
Thanks for sharing your code -- this all seems pretty strange, and thanks for helping debug. It almost looks like we're getting multiple instances of t / convex-test here -- if those logs are all from a single run, we have two different documents with _id 10000;users. Anything interesting in initCtxAndUser? Also if you're comfortable sharing more of your code with me, feel free to DM me and I'd be happy to take a look
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
Nothing stands out to me, but I thought you had an example of a non-custom mutation not returning the document earlier? run will use the basic convex ctx while mutation will use your custom mutation code, which could explain differences in behavior. But I'd expect run and a mutation using the basic _generated/server mutation wrapper to behave the same.
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
Hmm I still can't reproduce this with your createIdentity function and with asUser I'm on the latest version of convex-test (0.0.34)
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
(I set up something similar on my end and both things are returning as expected
const sessionA = await t.mutation(api.sessions.create, {})
console.log(
'from mutation',
await t.mutation(internal.sessions.test, { sessionId: sessionA })
)
console.log(
'from run',
await t.run((ctx) => {
return ctx.db.get(sessionA)
})
const sessionA = await t.mutation(api.sessions.create, {})
console.log(
'from mutation',
await t.mutation(internal.sessions.test, { sessionId: sessionA })
)
console.log(
'from run',
await t.run((ctx) => {
return ctx.db.get(sessionA)
})
)
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
Cool thanks for the extra testing -- what does createIdentity do?
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
Ooh ok gotcha -- just to narrow down the problem, if you create a mutation that just does db.get(args.subjectId), do you still observe the same issue? (t.run returns an object but t.mutation does not?) Also are you using customFunctions / customCtx at all?
34 replies
CCConvex Community
Created by hocino on 12/11/2024 in #support-community
Understand how Context works in test environment with Identity
The code using t.run isn't performing any access checks (it's just doing a db.get). If you're using customFunctions / customCtx for your access checks, that ctx is not the one that's used in t.run t.run is often useful for setting things up in a test without needing to get all the access control right + write extra functions just for the sake of test set up. What does the code in your mutation look like? What happens when you call that code inside your t.run?
34 replies
CCConvex Community
Created by entropy on 12/11/2024 in #support-community
Next build error when ran in github action
Do you want your github action to both deploy your convex functions to production + build and deploy your Next.js frontend? Or do you only want to do parts of this (like only build the frontend). If you're trying to deploy both convex + frontend, you'll want a deploy command like npx convex deploy --cmd 'npm run build' (I'm not familiar enough with bun to know the exact equivalents -- see https://docs.convex.dev/production/hosting/custom#custom-hosting). Usually build on its own just builds the frontend, and needs to be wrapped in npx convex deploy which handles setting the convex URL in an environment variable (NEXT_PUBLIC_CONVEX_URL is the default for next apps) + deploying your convex functions
8 replies
CCConvex Community
Created by Pedro Mameluque on 12/6/2024 in #support-community
String into ID !
Pointing this out just in case -- useQuery returns undefined when it's loading or skipped (and might also return null if you return null or undefined from your function), and if (!ticket) would catch both of these, vs. something like if (ticket === undefined) { return "Loading..." } else if (ticket === null) { return null }
23 replies