borisfyiB
Convex Community4mo ago
8 replies
borisfyi

How not to expose functions to the client but still be able to call them server side somehow?

Hello 👋

Following: general

I'm using Next.js App Router and in a server action I need to call a convex query.
I'm aware that I can protect queries with auth, but when I discovered internal function I figured not exposing the function to the client at all would be even better than protecting it.

Problem is: we can't call convex internal functions outside of some specific use cases. Actions are one of them. But in order to be able to call actions from my Next.js server action, this action needs to be public (ie: exposed to the client). I can see why it might be useful sometimes, but in my case the action would just wrap the internal function... effectively making that function public.

So: How not to expose functions to the client but still be able to call them server side somehow?

Thanks in advance for your help,

Boris
Was this page helpful?