medusa icon indicating copy to clipboard operation
medusa copied to clipboard

medusa-payment-paystack Plugin Not Recognized by Medusa v2 and Missing from Dashboard

Open the-berufegoru opened this issue 4 months ago • 0 comments

Description

I'm encountering an issue with loading the medusa-payment-paystack plugin in my Medusa v2 project. I installed the plugin using npm install medusa-payment-paystack and configured it as documented. However, Medusa does not recognize the plugin unless I explicitly reference it from ./node_modules/medusa-payment-paystack.

Additionally, after loading the plugin this way, the Paystack provider does not appear in the dashboard under payment providers.

Steps to Reproduce

  1. Install the plugin:
    npm install medusa-payment-paystack
    
  2. Add the plugin to the medusa-config.js file as follows:
    plugins: [
      {
        resolve: `medusa-payment-paystack`,
        options: {
          secret_key: process.env.PAYSTACK_SECRET_KEY,
        },
      },
    ],
    
  3. Start the Medusa server.

Error Message

If the plugin is not referenced directly from node_modules, the following error occurs:

Error: Unable to find the plugin "medusa-payment-paystack".
    at resolvePlugin (/home/the-berufegoru/backend/node_modules/@medusajs/medusa/src/loaders/helpers/resolve-plugins.ts:97:11)
    at /home/the-berufegoru/backend/node_modules/@medusajs/medusa/src/loaders/helpers/resolve-plugins.ts:137:21
    at Array.map (<anonymous>)
    at getResolvedPlugins (/home/the-berufegoru/backend/node_modules/@medusajs/medusa/src/loaders/helpers/resolve-plugins.ts:132:43)
    at exports.default (/home/the-berufegoru/backend/node_modules/@medusajs/medusa/src/loaders/index.ts:147:37)
    at async internalStart (/home/the-berufegoru/backend/node_modules/@medusajs/medusa/src/commands/start.ts:120:50)
    at async start (/home/the-berufegoru/backend/node_modules/@medusajs/medusa/src/commands/start.ts:221:5)

Temporary Solution

Referencing the plugin directly from node_modules as follows allows the server to load it:

plugins: [
  {
    resolve: `./node_modules/medusa-payment-paystack`,
    options: {
      secret_key: process.env.PAYSTACK_SECRET_KEY,
    },
  },
],

Expected Behavior

The plugin should load without direct referencing, and the Paystack provider should appear in the dashboard under payment providers.

the-berufegoru avatar Oct 26 '24 11:10 the-berufegoru