resend problems
How can I use resend with CONVEX, someone help me please. I am struggling with that for about 3 HOURS HAHAHA starting to get crazy
5 Replies
if you have specific questions, i recommend making a #support-community thread. I also recommend the ai chatbot on docs.convex.dev and search.convex.dev ( for example, maybe this will help https://discord.com/channels/1019350475847499849/1209891383310295050/1209898314690990150 )
heey
someone know how to implement: convex -> nextjs (app router) api -> resend
?
This is how I've implemented it, and it's probably not the best/efficient/clean way to do it, since you need to "curry" the JWT token all the way from the frontend through convex action to your Next.js API endpoint. This solution is only relevant if your trigger to send an email starts from a frontend action. For my use case, this is what I needed, and it is working.
So here it goes:
When you want to trigger your action, you need to grab the JWT token (I'm using Clerk, but there should be an equivalent hook for any other provider as well):
2. In your Convex action:
3. The internal action:
4. and finally the Next.js API route:
In general, you do not need Next.js API routes when you have Convex.
For Resend, you don't even need HTTP Actions, just send the email from an action using the Resend TypeScript API, like this:
https://github.com/xixixao/saas-starter/blob/main/convex/users/teams/members/invites.tsx#L135-L150
To use React add
jsx: "react-jsx"
to the convex/tsconfig.json and name your file with .tsx or .jsxGitHub
saas-starter/convex/users/teams/members/invites.tsx at main · xixix...
Convex, Clerk, Next.js, Convex Ents. Contribute to xixixao/saas-starter development by creating an account on GitHub.
thaaaaanks a lot man
wow
!!
It'll help a lot! You are the Goat! 🤌😎