Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings and error after running "yarn seed" configuration step #55

Open
collabgear opened this issue Jan 24, 2025 · 9 comments
Open

Warnings and error after running "yarn seed" configuration step #55

collabgear opened this issue Jan 24, 2025 · 9 comments

Comments

@collabgear
Copy link

Hello,

Trying to configure the fresh instance of mercur and after running "yarn seed" step I can see the following output:

info: Migrations completed.
[medusa-config] ⚠️ redis_url not found. A fake redis instance will be used.
[medusa-config] ⚠️ jwt_secret not found. fallback to either cookie_secret or default 'supersecret'.
[medusa-config] ⚠️ cookie_secret not found. fallback to either cookie_secret or default 'supersecret'.
info: Using fake Redis
✔ Models initialized – 22ms
✔ Plugin models initialized – 20ms
✔ Strategies initialized – 12ms
Error: Cannot find module '@medusajs/framework/utils'
Require stack:

  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/event-bus-local/dist/services/event-bus-local.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/event-bus-local/dist/index.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/dist/loaders/index.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/dist/commands/seed.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa-cli/dist/create-cli.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa-cli/dist/index.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/dist/bin/medusa.js
  • /home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/cli.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1244:15)
    at Function._load (node:internal/modules/cjs/loader:1070:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at Object. (/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/event-bus-local/dist/services/event-bus-local.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/event-bus-local/dist/services/event-bus-local.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/event-bus-local/dist/index.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/dist/loaders/index.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/dist/commands/seed.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa-cli/dist/create-cli.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa-cli/dist/index.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/dist/bin/medusa.js',
    '/home/collabgear/WebstormProjects/collabgear/mercur/marketplace/api/node_modules/@medusajs/medusa/cli.js'
    ]
    }

Seems like the setup procedure description lacks some essential steps?

@collabgear
Copy link
Author

The warnings
[medusa-config] ⚠️ redis_url not found. A fake redis instance will be used.
[medusa-config] ⚠️ jwt_secret not found. fallback to either cookie_secret or default 'supersecret'.
[medusa-config] ⚠️ cookie_secret not found. fallback to either cookie_secret or default 'supersecret'.

Were fixed by adding the following environment variables to .env file:

REDIS_URL
JWT_SECRET
JWT_EXPIRATION_TIME
COOKIE_SECRET

Obvious, but IMO makes sense to mention in the deployment procedure.

@collabgear
Copy link
Author

And it looks like the instructions on the page https://github.com/mercurjs/mercur?tab=readme-ov-file are outdated.
The command "yarn codegen" errors out.
Was only able to run it after executing "yarn build" from the project root folder.

@claudemircasa
Copy link

Same error here, any solution?

@collabgear
Copy link
Author

Same error here, any solution?

@claudemircasa , first of all I'd advise to use the instructions from github repo, not from npmjs.org .
AFAIU on npmjs.org they are outdated.

The instructions in github repo fail on the step "yarn codegen" ( the "apps/backend/package.json" simply does not have this script command )

The following worked for me ( after "yarn medusa db:create && yarn medusa db:migrate && yarn run seed" ):

cd ../..
yarn generate:oas
yarn codegen
yarn dev

@claudemircasa
Copy link

Yes @collabgear, in my case i used this steps and all work properly:

# Clone the repository
git clone https://github.com/mercurjs/mercur.git

# Install dependencies
yarn install

# Go to backend folder
cd apps/backend

# Clone .env.template
cp .env.template .env

# Remember to add the database address variable in the format:
DATABASE_URL=postgres://postgres:<password>@<host>:<port>/<db_name>

# Add your Stripe API key
STRIPE_SECRET_API_KEY=YouKeyHere

# Setup database and run migrations
yarn medusa db:create && yarn medusa db:migrate && yarn run seed

# Go to root folder
cd ../..

# Generate OpenAPI client
yarn generate:oas
yarn codegen
yarn dev

@collabgear
Copy link
Author

@claudemircasa , thank you for confirming.

@vholik , @slusarczykmichal , looks like the README file deserves an update?

FYI: also the "Docs" link in the section "Learn more about Mercur" is broken.

@claudemircasa
Copy link

@collabgear I'm using this new sequence of commands that seem to work better. I needed to create a Medusa user manually through the command line and now I'm having problems authenticating and creating sellers:

# Clone the repository
git clone https://github.com/mercurjs/mercur.git

# Install dependencies
yarn install

# Go to backend folder
cd apps/backend

# Clone .env.template
cp .env.template .env

# Remember to add the database address variable in the format:
DATABASE_URL=postgres://postgres:<password>@<host>:<port>/<db_name>

# Add your Stripe API key
STRIPE_SECRET_API_KEY=YouKeyHere

# Setup database and run migrations
yarn medusa db:create && yarn medusa db:migrate && yarn run seed

# Go to root folder
cd ../..

# Generate OpenAPI client
yarn generate:oas
yarn codegencd
yarn dev

# Create a new user (Medusa admin panel at http://localhost:9000/app/)
cd apps/backend
npx medusa user -e [email protected] -p somepassword

@adnanalahdab
Copy link

adnanalahdab commented Feb 3, 2025

@collabgear I'm using this new sequence of commands that seem to work better. I needed to create a Medusa user manually through the command line and now I'm having problems authenticating and creating sellers:

Clone the repository

git clone https://github.com/mercurjs/mercur.git

Install dependencies

yarn install

Go to backend folder

cd apps/backend

Clone .env.template

cp .env.template .env

Remember to add the database address variable in the format:

DATABASE_URL=postgres://postgres:@:/<db_name>

Add your Stripe API key

STRIPE_SECRET_API_KEY=YouKeyHere

Setup database and run migrations

yarn medusa db:create && yarn medusa db:migrate && yarn run seed

Go to root folder

cd ../..

Generate OpenAPI client

yarn generate:oas
yarn codegencd
yarn dev

Create a new user (Medusa admin panel at http://localhost:9000/app/)

cd apps/backend
npx medusa user -e [email protected] -p somepassword

@claudemircasa did you manage to create a user? I managed to create one. But when i sign in with that user iam not seeing any features or anything related to marketplace version of medusa. I just see normal medusa dashboard with no new features. Maybe because the account i made isnt a superadmin account or something?

@collabgear
Copy link
Author

@claudemircasa , @adnanalahdab , well, I have created the user with "npx medusa user" command, with the same result - no marketplace functionality appeared in the admin interface. Tried also to change the user role directly in the database ( it is an enum with 3 predefined values ).

Also the vendor/store registration UI gives an exception:

medusa-starter-default:dev: error: Value for Request.type is required, 'undefined' found
medusa-starter-default:dev: entity: Request {
medusa-starter-default:dev: data: {
medusa-starter-default:dev: seller: { name: 'Sample store 1' },
medusa-starter-default:dev: member: { name: 'Sample Seller' },
medusa-starter-default:dev: auth_identity_id: 'authid_...'
medusa-starter-default:dev: },
medusa-starter-default:dev: id: 'req_...',
medusa-starter-default:dev: created_at: 2025-02-03T21:08:45.219Z,
medusa-starter-default:dev: updated_at: 2025-02-03T21:08:45.219Z,
medusa-starter-default:dev: reviewer_id: null,
medusa-starter-default:dev: reviewer_note: null,
medusa-starter-default:dev: status: 'pending',
medusa-starter-default:dev: deleted_at: null
medusa-starter-default:dev: }

Sincerely, looks like the repo needs a lot of efforts to become mature or some essentials steps are amiss from the setup procedure.

I will personally opt out to the official Medusa recipe at https://docs.medusajs.com/resources/recipes/marketplace/examples/vendors for now.

Will add a link to the repo once I have something solid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants