resend not working in internalMutation
I had a problem where I wasn't able to send emails with Resend.
My API key was configured, my resend domain was verified and magic link email were working fine
(after setting the
I also read the docs extensively but I hadn't found or anticipated that this would happen
from
param). But when I tried to send emails at runtime resend.emails.send()
would give the error
After a long time debugging I found out that my problem was that I was trying to send emails from an internalMutation
. I switched to internalAction
and all immediately worked.
Could someone please explain the reason for this?I also read the docs extensively but I hadn't found or anticipated that this would happen
8 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!
Actions have access to "the internet". So basically they can interact with things outside of Convex. While mutations and query can't.
Actions can call third party services to do things such as processing a payment with Stripe. They can be run in Convex's JavaScript environment or in Node.js. They can interact with the database indirectly by calling queries and mutations.https://docs.convex.dev/functions/actions
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
Mutations insert, update and remove data from the database, check authentication or perform other business logic, and optionally return a response to the client application.https://docs.convex.dev/functions/mutation-functions
Mutations | Convex Developer Hub
Mutations insert, update and remove data from the database, check authentication
😳 thanks !! I really missed the fact the mutations cannot call 3rd party APIs.
Ah that's tough, you didn't see the error because it was a scheduled function?
When I run a mutation that fetches directly I get
but since you scheduled this, you would have had to check the dashboard logs to see the error