Handler for action X Not Found Workflow Error

The following error may occur in production if you use a when-then block in your workflow:

Code
custom-workflow:when-then-01JE8Z0M1FXSE2NCK1G04S0RR2:invoke - Handler for action \"when-then-01JE8Z0M1FXSE2NCK1G04S0RR2\" not found...

Why this Error Occured#

This error occurs if the when-then block doesn't return a step's result and doesn't have a name specified.

For example:

Code
1when(input, (input) => !input.is_active)2  .then(() => {3    console.log("not returning anything")4  })

The above when-then block doesn't return a step's result, which causes the error.


How to Fix it#

You can resolve this error by passing a name as a first parameter of when:

Code
1const result = when(2    "custom-when-condition",3    input, 4    (input) => !input.is_active5  )6  .then(() => {7    console.log("not returning anything")8  })

Additional Resources#

Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break