CustomCtx + ents not inferring wrapper for custom ctx.runMutations()
I'm a little lost.
I took my code from the action session wrapping for doing custom ctx.runMutation() and tried to do that since we now have ctx.runMutation available in mutations.
Goal
customMutation
withTriggerCtx doesn't throw (avoiding the ent wrapper)
but newCtx gets errors: tried casting it to several things
places i use
i get
4 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!
reference
ents mutationCtx
Without looking deeply, try not nesting
customMutation
s, make one that creates the ents wrapping and the session stuff? That might help you debug.
Also I'd really avoid ctx.runMutation inside mutations unless totally necessaryYeah, this is a nice to have as i do try to avoid the use of ctx.runMutation() but it does seem like the best solution i can figure to avoid my circular reference issues if my newer design doesn't work.
The use case for this particular function is basically to insure the events are safetly given admin context.
I think i'm going to remove the ents context from the first mutation as 99% of the logic is in ctx.runMutation()
I'm working towards having at least 300 functions that based on arrays are loop through and created.
This seems like it can be a significant performance penalty so id rather not do it twice like with a 2nd set of internal functions.