medusajs/medusa

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

Open

#15,442 创建于 2026年5月20日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)TypeScript (22,539 star) (2,090 fork)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

贡献者指南