David Alonso
David Alonso•2mo ago

Using a custom step context inside workflows

Just like there's a guide for creating a custom ctx inside Convex functions, I was wondering if there's something similar for workflows, where we can potentially pass authenticated user context from the function that starts the workflow into the workflow step
7 Replies
Convex Bot
Convex Bot•2mo ago
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!
David Alonso
David AlonsoOP•2mo ago
related to workflows, is there a way to set a timeout after which to cancel the workflow? oh and another one: is there a way to reactively subscribe to the status of a workflow?
ian
ian•2mo ago
1. For now I would have the first line of the function be const myStep = wrapStep(step); 2. You can schedule a function for the future to check the status & cancel the workflow if it's still running 3. Yes all queries on workflow status are reactive. The status will likely get richer soon as I add pause/resume, etc.
David Alonso
David AlonsoOP•2mo ago
Super helpful, thanks! I couldn't find a channel for workflows, so I'll ask here: what's the estimated time to get pause/resume released? I'm excited for that 🙂
ian
ian•2mo ago
Working on it today! GitHub issues for each component are good spots for feature request / discussion
ian
ian•2mo ago
GitHub
Ian/pause by ianmacartney · Pull Request #122 · get-convex/workflow
Fixes #19 Fixes #25 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
David Alonso
David AlonsoOP•2mo ago
Excited about this one too: https://github.com/get-convex/workflow/issues/27 Currently having to create mutation function wrappers for workflows to call them from other workflows, but passing onComplete isn't really easy in a type safe way through the mutation args
GitHub
Add an API for composing workflows · Issue #27 · get-convex/workflow
export const parentWorkflow = workflow.define({ handler: async (step) =&gt; { await step.runWorkflow(internal.example.childWorkflow, childWorkflowArgs) } }) If the parent workflow is canceled, ever...

Did you find this page helpful?