error: Error starting server
{
name: 'ModuleProviderError',
message: 'Errors while loading module providers for module payment:\n' +
"Cannot find module './modules/payment-wayforpay'\n" +
'Require stack:\n' +
'- /.../node_modules/@medusajs/utils/dist/common/dynamic-import.js\n' +
'- /.../node_modules/@medusajs/utils/dist/common/get-config-file.js\n' +
'- /.../node_modules/@medusajs/utils/dist/common/index.js\n' +
#The custom payment provider resolution is broken in the latest RC-5 release.
67 messages Β· Page 1 of 1 (latest)
Can you do ./src/modules/payment-wayforpay please?
And if it persists could you open an issue and reference it here please
I'm getting same error.
You are on the last rc? Can you share your version please
But can you share the version cause we released multiple today π
Is it this one that got installed 2.0.0-rc-20241015170251?
yes, 2.0.0-rc-20241015170251
I can see the issue is coming from the get config file util, is your medusa config file in ts?
yes it is .ts file
Can i get you to transform it to js in order to test a theory please, it would mean changing import to require and adding allowJs in your tsconfig file
As mentioned you need to move import to require
I changed import to
const { Modules, loadEnv, defineConfig } = require('@medusajs/framework/utils')
And if you can re add allowJs in your ts config, then you can retry and let me know
Ok so this fix the config loading but then there is the loader issue, thank you very much for those elements. Could i get you to create an issue on GitHub referencing this conversation and then yoi can ref the issue here as well please π
And if you can share what command you are running and from where as well please
ok, got it thank you.
Can you just share the command and location from where you run it as well please
I'm not sure what you mean
To run your project, which command are you running and where are you running it from
ok, i run yarn dev from medusa-backend
Ok thank you very much, that way we have all the elements here as well
It gives us the steps to reproduce πalways good to have
thanks
Hello Wick!
I just created a new project with a custom module and all seems to be working fine.
Can you please push your code to some repo and share that with us?
here, thanks
this pr will resolve it right ? https://github.com/medusajs/medusa/pull/9601/files
same thing happens with custom notification provider
Morning guys
We found many issues with both your setup and some internal implementation. We will fix our issues and let you know about the changes you have to make on your project as well asap
Ok, so we have done the fixes that were needed on our side and are part of the rc-6, on your side here are the changes that you need to apply based on the previous RC changes:
You can move back your medusa-config.js to medusa-config.ts and therefore move back from require to import etc.
you need to change the resolve of the modules from @medusajs/the-module to @medusajs/medusa/the-module for all medusa modules that you are configuring.
in your package.json you need to change your dependencies/devDependencies to the following
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"pg": "^8.13.0"
},
"devDependencies": {
"@mikro-orm/cli": "5.9.7",
"@swc/jest": "^0.2.36",
"medusa-test-utils": "rc",
"@types/jest": "^29.5.13",
"jest": "^29.7.0",
"@types/node": "^20.0.0",
"@swc/core": "1.5.7",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^5.2.11"
},
As you can see, no need to install the modules packages individually as they are part of the medusa package and reexported through sub path.
Can I get you to test it and report back here please π
I changed it all & update new rc, but getting this
......
but if I comment my custom payment module it works
can you change ./modules to ./src/modules and try again please
ok, works
do i need to add ./src to all my custom modules ?
or only custom payment ?
to all relative path for your custom modules and providers
the doc need to be updated but we already mentioned it internally
since now we also have a standalone build everything will work even for the prod build since it mimics the directory structure
ok, thank you
this should fix it, one place slipt away from our review, I am generating a snapshot so that you can play with it https://github.com/medusajs/medusa/pull/9608
GitHub
FIXES FRMW-2747
What
Add missing paths options
okay, changing path for module to ./src/modules works for notification providers, and also doesn't work for db:migrate command, same as Wick described with payment provider
Confirmed. Running npx medusa db:migrate still doesnβt resolve the providers.
I am running the rc version and had this error. I got the error fixed and the app is up and running. just that my new payment provider doesn't show up in the ui.
#1296242362925846548 message
This is because you have created a module and not a provider, you can already see the difference just by comparing your config to the config shared here
gotcha!
i changes to provider. now i get this error
error: Error starting server
Error: Cannot find module './modules/providers/razorpay'
tried changing from ./modules/ to ./src/modules and now my error message changers to this:
error: Could not resolve module: Payment. Error: Loaders for module Payment failed: Trying to register a payment provider without a provider identifier.
error: Error starting server
Error: Loaders for module Payment failed: Trying to register a payment provider without a provider identifier.
i followed the repo put by @onyx scroll https://github.com/thetutlage/medusa-payment-provider
edit: i updated to the latest rc but still getting the same error
rm -rf node_modules
rm yarn.lock
yarn
I ve summarized at different point the changes needed in the above discussion, can you change ./modules do ./src/modules and it seems that you are missing an identifier as per the error
I suggest you to follow the documentation π
i actually followed this documentation believing that it is the latest but then came here to realise that it is done differently. is there any other documentation you are referring to?
I have also cloned the above shared @onyx scroll 's repo into my local and tested and getting the same error.
Error: Loaders for module Payment failed: Trying to register a payment provider without a provider identifier.
one more thing i have observed is that after adding the provider and running the migration, it fails in couple of scenarios and passes in one scenario
so when i run npx medusa db:generate payment with resolve values ./src/modules/providers/crypto and ./modules/providers/crypto the migration failes with errors
info: Generating migrations...
------------------------------------------
error: Cannot find module './modules/providers/crypto'
info: Generating migrations...
------------------------------------------
error: Unable to resolve the migration scripts for the module payment
Cannot find module './src/modules/providers/crypto'
and when i run with the resolve value set to /src/modules/providers/crypto it passes
info: Generating migrations...
------------------------------------------
info: MODULE: payment
info: Generated successfully (Migration20241017073405.ts).
------------------------------------------
info: MODULE: payment
info: Generated successfully (Migration20241017073406.ts).
------------------------------------------
info: MODULE: payment
info: Skipped. No changes detected in your models.
------------------------------------------
info: Migrations generated
but i still cant apply the migration:
@runic pendant Can you please share your code as a repo?
Yup, that was fixed yesterday. But I think the new RC isn't out yet. We will let you know once its out
It was fixed in this PR https://github.com/medusajs/medusa/pull/9608 which hasn't been released yet
ok, much appreciated for your support.
i can share mine as a repo, but it is same as yours. in just cloned yours and ran yarn that installs the dependencies. And i get the same errors as above.
I was released just now