Using node runtime in Convex Triggers
The Convex helper library providers triggers which essentially wraps the useMutations. There are some actions that I would like to run for each trigger. However, this action need to be run in the nodejs environment due to the use of third party api (I am using
Ably in my case). However, if I mark the file with use node for the file that I define my triggers action, it means that the wrapped useMutation is also marked with use node which violates the Convex rules about mutations. How to get around this?5 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!
Would it work to have the triggered function schedule the action that needs Node?
The
ctx object in the trigger function exposes only runQuery and runMutation. I can’t call runAction on the context object.
Is there other way I can schedule an action?Scheduled Functions | Convex Developer Hub
Schedule functions to run in the future
Just to be clear, scheduling sets up the target function to run separately from whatever function did the scheduling; i.e. it's a separate process. If you need data from the scheduled function, this won't work.