medusajs/medusa
View on GitHub[Bug]: Workflows are not being picked up by worker if the file is named index.[js,ts]
Open
#15442 opened on May 20, 2026
good first issuetype: bugversion: 2.0
Description
Package.json file
N/A
Node.js version
v22.0.0
Database and its version
16.2
Operating system name and version
N/A
Browser name
No response
What happended?
When the workflow loader runs, it excludes index.[js,ts] files since they are usually used for barrel exports (but not always), as seen here. If the index file exports an actual workflow, it will not work due to this filtering
Why would this typically work with a WORKER_MODE=server/shared? Typically workflows are called from HTTP routes - when the HTTP routes are loaded the workflows will get registered implicitly as well. However, a WORKER_MODE=worker instance never loads the HTTP routes, and therefore never loads the workflow.
Expected behavior
All workflows are loaded, regardless of the file name
Actual behavior
Workflows in index.ts file are not loaded
Link to reproduction repo
N/A