#how to run seeds for admin credentials in railway

50 messages · Page 1 of 1 (latest)

subtle terrace
#

good night friends, do any of you know how to seed in railway?

zealous plank
#

What a night my friend ?
I have some questions also, do you use a template, can you share it, what about the Docker file that causes a fail ?
I ask this because there is no official doc about Railway deployment atm

clear sleet
subtle terrace
subtle terrace
zealous plank
subtle terrace
zealous plank
#

Hi @subtle terrace have you been able to fix the seeding problem ?

subtle terrace
#

Yes, I did, but not in the best way.

zealous plank
#

Can you explain how you solved it please ?

#

in short words in case someone asks the same question

subtle terrace
#

Wait a moment please

zealous plank
#

Thank you

subtle terrace
#

here change the command to

medusa migrations run && npm run seed && medusa develop

zealous plank
#

Thank a lot my friend, I'll cite your solution

subtle terrace
#

after the redeploy is done you delete the seed command

zealous plank
#

Nice this is very important for the others

subtle terrace
#

it is easier if you connect remotely with the terminal

zealous plank
#

You mean with the Railway command line

subtle terrace
#

Yes

zealous plank
#

Okey

subtle terrace
#

Ok

zealous plank
#

Thank a lot for sharing, it will really be usefull as it works the same I think for everyone

subtle terrace
#

You're welcome friend, we are here to help and to help us

hearty pelican
#

How do I create admin ? User , I linked to the backend using the railway CLI

#

And this command does not work

versed wharf
#

What error do you get?
Try npx @medusajs/medusa user -e admin@medusa-test.com -p supersecret
Make sure you are in the root of your medusa backend folder

hearty pelican
#

the backend on railway stopped working, i deleted the project on railway three times, hit the deploy link, changed the env variables to lowercase. health check not working. so the adding user can't even test again, the redis is not connecting

hearty pelican
#

i am back attemting to add the admin user, i have the backend working

#
railway run npx medusa user --email can@trbzink.com --password supersecret
#

could not determine executable to run is the error message

#

@versed wharf I installed medusa CLI, to railway. getting the following errors

#
TypeError: cmd is not a function
    at /Users/stunjiturner/Library/pnpm/global/5/.pnpm/@medusajs+medusa-cli@1.3.21/node_modules/@medusajs/medusa-cli/dist/create-cli.js:229:13
    at /Users/stunjiturner/Library/pnpm/global/5/.pnpm/@medusajs+medusa-cli@1.3.21/node_modules/@medusajs/medusa-cli/dist/create-cli.js:48:30
    at Object.handler (/Users/stunjiturner/Library/pnpm/global/5/.pnpm/@medusajs+medusa-cli@1.3.21/node_modules/@medusajs/medusa-cli/dist/create-cli.js:16:21)
    at Object.runCommand (/Users/stunjiturner/Library/pnpm/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/Users/stunjiturner/Library/pnpm/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.parse (/Users/stunjiturner/Library/pnpm/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/yargs.js:584:29)
    at exports.default (/Users/stunjiturner/Library/pnpm/global/5/.pnpm/@medusajs+medusa-cli@1.3.21/node_modules/@medusajs/medusa-cli/dist/create-cli.js:321:10)
    at Object.<anonymous> (/Users/stunjiturner/Library/pnpm/global/5/.pnpm/@medusajs+medusa-cli@1.3.21/node_modules/@medusajs/medusa-cli/dist/index.js:38:26)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
versed wharf
#

Again, make sure you are in the root of your medusa backend folder

hearty pelican
#

in railway server? figuring out how to get there

versed wharf
#

You should be able to use the cd command. Not sure where exactly you need to cd to. Maybe from the default working directory it is just the name of your repo. Just a guess. From default, try using ls to see options.

#

Also try pwd to see the full working directory path

hearty pelican
#

I created a railway shell, but PWD does work even when, i added a command medusa seed and it creates a user, i still cant log in, with the user from the Admin deployed on Vercel...

versed wharf
#

You used lowercase or uppercase? It has to be lowercase

versed wharf
#

Another way to accomplish this would be to run the command from your local dev environment with it connected to whatever db is connected to the Railway instance.

hearty pelican
#

i did that, thx @versed wharf

versed wharf
#

Have you deployed your admin separately from your backend? I think you've confused your admin and backend urls. The link you posted, /admin/auth, should be your backend based on the path, but it takes me to your admin.

hearty pelican
#

I have deployed them separately

Backend - Railway
Admin - Vercel

#

On the Vercel , Open the Environment Variables collapsible, and add an environment variable with the name MEDUSA_ADMIN_BACKEND_URL with the value being the URL to your deployed Medusa backend. this should be the value in from railway correct?

versed wharf
#

Yes, but your admin app is trying to access the backend at your vercel url

hearty pelican
#

So the admin should be running on railway as well