medusajs/medusa · warning
The subscriber in ${path} is not a function. skipped.
Error message
The subscriber in ${path} is not a function. skipped. What it means
During startup, the SubscriberLoader validates every file in src/subscribers. validateSubscriber requires the default export to be a function (the event handler). If subscriber.default is missing or not a function, the file is skipped with this warning and its handler will never receive events.
Source
Thrown at packages/core/framework/src/subscribers/subscriberLoader.ts:85
const handler = subscriber.default
if (!handler || typeof handler !== "function") {
/**
* If the handler is not a function, we can't use it
*/
this.logger.warn(`The subscriber in ${path} is not a function. skipped.`)
return false
}View on GitHub (pinned to 5e06e544a2)
Solutions
- Add a default-exported async handler to the file: export default async function productCreatedHandler({ event, container }) { ... }
- If the file is not meant to be a subscriber, move it out of src/subscribers (e.g. to src/lib) so the loader ignores it
- Prefix the file with _ or set config.isFileSkipped if you intentionally want the loader to skip it
Example fix
// before
export const config = { event: "product.created" }
export function handleProductCreated(args) { /* ... */ }
// after
export const config = { event: "product.created" }
export default async function handleProductCreated({ event, container }) {
/* ... */
} Defensive patterns
Strategy: type-guard
Type guard
type SubscriberModule = { default: (args: any) => Promise<void>; config: { event: string | string[] } }
const isValidSubscriber = (m: any): m is SubscriberModule =>
typeof m?.default === "function" && !!m?.config?.event Prevention
- Always include export default async function ... in subscriber files
- Run a small startup script that imports each src/subscribers file and asserts a function default export
- Keep helpers out of src/subscribers
When it happens
Trigger: A file in src/subscribers (or a plugin's subscribers dir) that exports no default function, exports a class/object/constant as default, or only exports named members (e.g. only `config`).
Common situations: Forgetting `export default async ({ event, container }) => {...}` and only exporting the config object; renaming the handler to a named export; scaffold files from tutorials that omit the default export.
Related errors
- The subscriber in ${path} is missing a config. skipped.
- The subscriber in ${path} is missing an event in the config.
- The subscriber in ${path} has an invalid event config. The e
- Invalid default export found in ${absolutePath}. Make sure t
- Failed to clear events for eventGroupId - ${flowEventGroupId
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/3dfeee2002e315b2.
Report an issue: GitHub.