erquhart
Explore posts from serversCCConvex Community
•Created by winsoroaks on 4/29/2025 in #support-community
How to properly combine a Convex query with an action?
queries can't await actions but actions can await anything
9 replies
CCConvex Community
•Created by winsoroaks on 4/29/2025 in #support-community
How to properly combine a Convex query with an action?
Yep, you would call the action from the client, and in the action you can
await ctx.runQuery()
for the encrypted data, decrypt it, and return9 replies
CCConvex Community
•Created by winsoroaks on 4/29/2025 in #support-community
How to properly combine a Convex query with an action?
If the reactivity isn't important you could just run an action to get everything at once, but guessing you want it reactive
9 replies
CCConvex Community
•Created by winsoroaks on 4/29/2025 in #support-community
How to properly combine a Convex query with an action?
I can see that. But if you're fetching data on the server and you cannot store it anywhere due to it's sensitive nature, I don't know how much cleaner you're going to get than this in any reactive framework.
9 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
I actually keep all use of ctx.db inside that db/ folder, so all my convex functions just use this db object to interact with the db, and they never have to think about validation, indexes, etc, that all belongs to the db layer.
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
I have a
convex/db
folder with an index that exports an object with each table file's exports, so for me it looks like:
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
Something like:
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
Hope this is at all helpful lol, I know you were really just wanting to use a helper
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
I actually keep my table schemas in table specific files along with the insert/patch helpers, in which case you could parse with Zod using the same schema that you're using for table definition.
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
But again, with the helper not written, you could also go the manual route with something like what I outlined. Both provide centralized validation, both require remembering to use a helper every time you write.
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
Actually, the schema approach is a better guarantee than function validation because the schema is centrally defined for each table, I take that back
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
I don't disagree, but this approach still doesn't give the system level guarantee of an actual schema validator, it just ensures that zod validation runs on reads and writes wherever the custom query/mutation is used - which isn't all that dissimilar from just validating the functions themselves. But the root issue is the helper doesn't currently exist, so that limits your options a bit if writing it isn't in the cards.
Fwiw I personally handle it in a more manual way:
- each table has a dedicated helper for insert and for patch, one each per table
- ctx.db.insert/patch are only used in these helpers
- validate however you like, Zod or otherwise, in the helpers
- nothing gets written that doesn't pass validation
13 replies
CCConvex Community
•Created by DenisB on 4/29/2025 in #support-community
How to use Zod for validating database writes?
You'd have to understand the example in rowLevelSecurity well enough to write the helper. I'd recommend reading over Ian's recommendation from the article (tl;dr: using Zod to validate server functions is probably enough): https://stack.convex.dev/typescript-zod-function-validation#what-would-i-do
13 replies
CCConvex Community
•Created by too_easy on 4/29/2025 in #support-community
Any way to populate convex environment variables via 3rd part
Yeah you would generally just sync secrets from a provider like infisical to convex, vercel, etc. Secrets management services often have webhooks, so you could have a GitHub action or something that uses the cli's of Convex, Vercel, etc. to update env vars in those services when secrets change in the secrets manager.
4 replies
CCConvex Community
•Created by winsoroaks on 4/29/2025 in #support-community
How to properly combine a Convex query with an action?
Yeah you'll want to run the action when the query changes, both from the client. An updatedAt timestamp field on the table with the encrypted data would help, so you can just query that and run the effect when it changes.
9 replies
CCConvex Community
•Created by Zachoo on 4/28/2025 in #support-community
Logout after period of Inactivity Convex + Clerk - Expo APP
Where in this logic is the user getting unexpectedly logged out
4 replies
CCConvex Community
•Created by Waffleophagus on 4/27/2025 in #support-community
"Upgrading" Anonymous accounts to "real" accounts with email
Again, that's how anon accounts work out of the box, haven't looked at whether configuration can change this.
24 replies
CCConvex Community
•Created by Waffleophagus on 4/27/2025 in #support-community
"Upgrading" Anonymous accounts to "real" accounts with email
(So no way to hijack)
24 replies
CCConvex Community
•Created by Waffleophagus on 4/27/2025 in #support-community
"Upgrading" Anonymous accounts to "real" accounts with email
Right, but there's no way for anyone to log in and get an existing anon account. Even that anon user, if they signed out, wouldn't have a way to sign back in to that same account.
24 replies
CCConvex Community
•Created by Waffleophagus on 4/27/2025 in #support-community
"Upgrading" Anonymous accounts to "real" accounts with email
Anon accounts can't be re-logged into I don't think, unless you're doing something custom. So no concern there.
24 replies