This topic was automatically generated from Slack. You can find the original thread here.
Hey guys, I’m trying to set up re-runs for a workflow that I’m running. I need the rerun to be triggered after a delay of about 15 mins. I’ve set up an error listener workflow to catch the ID and set up a delay in the next step. I generated some code (which I’ll attach in the thread) to try to use the pipedream api to trigger the re run. However I don’t think it is actually functioning and I’m not sure why. Is this the best way to do this?
Hello , I think to rerun a workflow, the approriate way should be adding the HTTP trigger to your workflow, then call the HTTP Endpoint in your second workflow. For example:
The first workflow has the HTTP trigger with the endpoint https://eo2s1f43oqhpya7.m.pipedream.net (1st image below)
So on the second workflow, you can use axios call to that endpoint
Hey Leo, I’m not sure that will work here. Because I’m trying to rerun specific failed events from a workflow which already has a trigger (that I cannot replace).
I’m thinking of a workaround for you. May I ask in your failed event, is there data included? If the data is included, you can add that data as the body in your HTTP request to your first workflow, so that your first workflow will process that data again
You don’t need to duplicate your workflow, you can add multiple triggers into the same workflow (In your case, it would be your first workflow). Just follow the steps below
I had a play around with it. Difficulty is that my original trigger has all of its data under steps.trigger.event while for the webhook trigger I can only get it under steps.trigger.body.event. I’m not sure how I can clean that up for use
, I apologize for the late response. In this case you can add a simple code step to get the data out of the event, and modify your action to use the data from that code step instead. For example:
// To use previous step data, pass the `steps` object to the run() function
export default defineComponent({
async run({ steps, $ }) {
// Return data to use it in future steps
return steps.trigger.event || steps.trigger.body.event
},
})
Please see the image below. Now in your workflow, instead using steps.trigger.event or steps.trigger.body.event, you should use steps.get_event.$return_value
I guess that could work. Tricky thing might be that in my current setup the error in one step can be caused by an error in the previous step (data not yet available). So I need to delay it and then retry the previous step.
For sure possible to rewrite the two step process into one codestep and then applying the $.flow.rerun() to the first one if it errors or doesn’t return the expected data. I’ll keep that as food for thought