medusajs/medusa

[Bug]: Workflows are not being picked up by worker if the file is named index.[js,ts]

Open

#15,442 opened on 2026年5月20日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)TypeScript (22,539 stars) (2,090 forks)batch import
good first issuetype: bugversion: 2.0

説明

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

コントリビューターガイド