helping Delveroff
Hi! Could somebody help me? I need to call internal queries/mutations remotely. I use Next.js and SSR. I would like to
fetchQuery(internal.tasks.list)
. But it doesn't work. I want to make queries internal so I don't validate the input parameters (I want to do it elsewhere).
Supabase, i.e., provides us with two keys: default and anon. Anon is for public API. Default is for private use.15 Replies
Module: nextjs | Convex Developer Hub
Helpers for integrating Convex into Next.js applications using server rendering.
I need to call internal queries/mutations remotely.The only way to do this currently is using http actions https://docs.convex.dev/functions/http-actions. Then you can call convex functions from external API's
Yeah, it gives the following error
Could you show a little code if you dont mind
i would like to see how your using this function so i can debug the error better
Sure
I don't have something more verbose since I'm just playing with Convex
import { fetchQuery } from 'convex/nextjs'
So your defining a function
test
.
1. The internal function is missing the args object.
i would recommend making these public queries and using a shared secret to authenticate
search discord for "shared secret" to find examples
2. fetchQuery is meant to be used in your nextjs react component not in your
convex/
function directoryYeah, I know, this is for example simplicity
It doesn't matter since the error is about 'internal' and 'public' mismatch on TypeScript level
internal functions can only be called by public convex functions, thats why this is not working
I was thinking exactly about this. Thank you for a "shared secret" hint, will search Discord with it.
Great! It will do, thank you!