medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.97k stars 2.61k forks source link

[Bug]: Plugin setup fails #10126

Open stephane-segning opened 22 hours ago

stephane-segning commented 22 hours ago

Package.json file

{
  "name": "@vymalo/backend",
  "version": "1.0.0",
  "description": "Vymalo Backend",
  "author": "Vymalo Team (https://gitbuh.com/vymalo.com)",
  "private": true,
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "medusa start",
    "dev": "medusa develop",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "migrations": "medusa db:migrate",
    "add:user:admin": "medusa user -e admin@domain.local -p password"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.0.4",
    "@medusajs/cli": "2.0.4",
    "@medusajs/framework": "2.0.4",
    "@medusajs/medusa": "2.0.4",
    "@medusajs/payment-stripe": "2.0.4",
    "@medusajs/utils": "2.0.4",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "@vymalo/medusa-keycloak": "^1.0.1",
    "@vymalo/medusa-mail": "^1.0.1",
    "@vymalo/medusa-minio": "^1.0.1",
    "@vymalo/medusa-printful": "^1.0.1",
    "awilix": "^8.0.1",
    "axios": "^1.7.7",
    "pg": "^8.13.1"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.0.4",
    "@mikro-orm/cli": "5.9.7",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "ngrok": "4",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

20

Database and its version

PostgreSQL 17 (Docker)

Operating system name and version

MacOS

Browser name

No response

What happended?

So I've written a plugin for integrating printful APIs into product creation (and more), it's available on npm https://npmjs.com/package/@vymalo/medusa-printful.

The plugin, while in development phases work fine (APIs are callable, modules are loaded, subscribers are loaded,...) when compiled, it fails directly to load everything.

Expected behavior

The content of my plugin should be loaded, simply. I could then have access to my created endpoints.

Actual behavior

I get the error:

Unable to find the plugin "@vymalo/medusa-printful".

Then I located the file resolve-plugin.ts and still couldn't make it to work, after two days in total of editing.

Link to reproduction repo

https://github.com/vymalo/web-store

stephane-segning commented 4 hours ago

Found the source of bug and implemented a fix for it in #10132.