medusajs/medusa

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

已關閉

#15,442 建立於 2026年5月20日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (2,090 個分叉)batch import
good first issuetype: bugversion: 2.0

倉庫指標

星標
 (22,539 顆星)
PR 合併指標
 (平均合併 10天 22小時) (30 天內合併 185 個 PR)

描述

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

貢獻者指南