How to preload data with Remix?
I understand in nextjs you can preload data with preloadQuery, but in remix it terminate the server, I also need to send the logged in user to convex, im using convex auth.
Error: Environment variable NEXT_PUBLIC_CONVEX_URL is not set.
I tried to add this env variable, but didnt work, in the past it did.
I also think adding the data to useQuery would be great...
But how to fix this problem in remix? so i can remove the code below 😦
Many thanks
9 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
this works, but still missing the authentication stuff...
Cant u use just fetch query?
@FleetAdmiralJakob 🗕 🗗 🗙 no i need to feed it the token 😦
@jamalsoueidan you need to set the convex URL, see https://docs.convex.dev/api/modules/nextjs#nextjsoptions
Module: nextjs | Convex Developer Hub
Helpers for integrating Convex into Next.js applications using server rendering.
prealoadQuery takes options for this, they default to using the environment variable with the standard name in Next.js, but you can use any value.
@ballingt thank you, but how do I get the token, which method to use, im using convex auth?
I tried to get manually from __session, it doesnt work, in the localstorage i can see the token, but this is not actually send with the request, im not sure how to handle this! Can you provide any example.
Do you see a
__convexAuthJWT
header?I see __convexAuthJWT in the localstorage, but not in the cookie or header,,,
Can we convert the nextjs functionality to remix,,,i think more and more people is using remixjs,,,