{"record":{"id":"3dfeee2002e315b2","repo":"medusajs/medusa","slug":"the-subscriber-in-path-is-not-a-function-skipp","errorCode":null,"errorMessage":"The subscriber in ${path} is not a function. skipped.","messagePattern":"The subscriber in (.+?) is not a function\\. skipped\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/framework/src/subscribers/subscriberLoader.ts","lineNumber":85,"sourceCode":"    const handler = subscriber.default\n\n    if (!handler || typeof handler !== \"function\") {\n      /**\n       * If the handler is not a function, we can't use it\n       */\n      this.logger.warn(`The subscriber in ${path} is not a function. skipped.`)\n      return false\n    }","sourceCodeStart":null,"sourceCodeEnd":null,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/framework/src/subscribers/subscriberLoader.ts#L85","documentation":"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.","triggerScenarios":"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`).","commonSituations":"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.","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"],"exampleFix":"// before\nexport const config = { event: \"product.created\" }\nexport function handleProductCreated(args) { /* ... */ }\n\n// after\nexport const config = { event: \"product.created\" }\nexport default async function handleProductCreated({ event, container }) {\n  /* ... */\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"type SubscriberModule = { default: (args: any) => Promise<void>; config: { event: string | string[] } }\nconst isValidSubscriber = (m: any): m is SubscriberModule =>\n  typeof m?.default === \"function\" && !!m?.config?.event","tryCatchPattern":null,"preventionTips":["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"],"tags":["subscribers","event-bus","bootstrap","export"],"backgroundTag":"invalid-default-export","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}