What Could Be Preventing This Workflow from Terminating?

This topic was automatically generated from Slack. You can find the original thread here.

Please what could cause this workflow not to terminate as it shows here

The workflow goes ahead to run instead of terminating…

image.png

Did you **return** $.flow.exit()?

No, but is this required? Is this a new thing?

It is required. And it’s not new.

Oh wow

Aii… Thanks

: I don’t think this is documented anywhere, is it? :point_up_2:

The only “documentation” I could find is this thread.

should be documented here: Running Node.js in workflows - Pipedream

and note that it’s technically not required but return is likely what you want. If you don’t use return, $.flow.exit will end the workflow at the end of the current step. That’s noted in that section

~That doesn’t seem to be the case though.~

~Without return, $.flow.exit seems ineffective.~ :thinking_face:

Nope, nvm, it works either way. :+1:

It does work without return…

Which is why the scenario I initially shared is not understood

yes, that is by design as we’ve implemented it, but if you want to exit at the point at which you call $.flow.exit, use return $.flow.exit()

Ohh… I see the distinction now

right, return is at this specific point, no return exits at the end of the step