Error: make sure your module has a default export of a service.

If you get the following error while building your Medusa application:

Terminal
❯...doesn't seem to have a main service exported -- make sure your module has a default export of a service

Why this Error Occurred#

This error occurs when you set the resolve path of a module provider to point directly to a service file instead of the module directory.

For example, if you set the resolve path to ./src/modules/slack/service:

medusa-config.ts
1module.exports = defineConfig({2  // ...3  modules: [4    {5      resolve: "@medusajs/medusa/notification",6      options: {7        providers: [8          {9            resolve: "./src/modules/slack/service",10            id: "slack",11            options: {12              channels: ["slack"],13              webhook_url: process.env.SLACK_WEBHOOK_URL,14              admin_url: process.env.SLACK_ADMIN_URL,15            },16          },17        ],18      },19    },20  ],21})

You'll get the error because the resolve path is pointing to the service file of the module provider, while it should point to the module directory.


How to Fix it#

To fix the error, set the resolve path to point to the module directory instead of the service file. For example:

medusa-config.ts
1module.exports = defineConfig({2  // ...3  modules: [4    {5      resolve: "@medusajs/medusa/notification",6      options: {7        providers: [8          {9            resolve: "./src/modules/slack",10            id: "slack",11            options: {12              channels: ["slack"],13              webhook_url: process.env.SLACK_WEBHOOK_URL,14              admin_url: process.env.SLACK_ADMIN_URL,15            },16          },17        ],18      },19    },20  ],21})
Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵