Hi, so right now I have my project working with postgres, I use meilisearch, minIO and medusa admin what I ejected and customized, all locally right now. I want to deploy it live, so my friend can also see it etc. I looked into docs and tought I will deploy backend to Railway and storefront to Vercel right now. What exactly I need to do, to deploy it, because right now im lost. I have backend and storefront pushed to github. I also tried to deploy my backend repo on Railway but I get errors, I followed medusa docs. It's first time I'm doing it so yeah, if someone can help, would mean a lot.
#Deploying my project
1 messages · Page 1 of 1 (latest)
.
The error tells you information on how to fix it. You need to update the version of the peer dependency in your customized admin to match the version of your server.
#11 4.100 npm ERR! Fix the upstream dependency conflict, or retry
#11 4.100 npm ERR! this command with --force, or --legacy-peer-deps
so I go into customized medusa admin if I'm correct, and what exactly I need to run there?
I think I fixed it with yarn upgrade --scope @medusajs/medusa --latest because now the build was successful.
but now if I try to go to railway deployment domain link and write /store/products I get, application failed to respond, GET https://bons-pagaristuudio-backend-production.up.railway.app/store/products 503, and in the deployment log I get, also deployment crashes after sometime.
The error log tells you why:
[medusa-config] ⚠️ redis_url not found. A fake redis instance will be used.
On a service like railway, fake redis will run out of memory quickly, if it even manages to get up and running at all.
I also think railway will not be able to build the admin. Someone else posted about that. You will need to build it before you deploy.
Okay, where I can found more info about that?
But what should I do then to deploy my project? I tried to disable admin build, and deployed admin to Vercel, but on railway deployment still crashes, even without admin.
Please stop tagging me. No one here is tech support. I pointed you in the right direction (your redis instance is not congured, and you need to build your admin before you deploy), but I'm not going to research and resolve your issue for you. You know what you need to do now and can search Discord, Google, and the docs.
Okay, no problem, i will try
So I got so far, I got my backend up on railway, i got my storefront deployed and connected with medusa server, can also see changes in the deployment log. Now I have customized medusa admin deployed on Vercel, I see log in page, I also added STORE_CORS and ADMIN_CORS, but if i refresh my medusa admin depolyment site I get this error.
.
Could indicate that you haven't added a Vercel config to your project.
https://docs.medusajs.com/deployments/admin/deploying-on-vercel#step-3-add-vercel-configurations
I added it to my root, I also changed MEDUSA_BACKEND_URL in vite.config with my medusa server. I get in the console Access to XMLHttpRequest at 'https//...railway' from origin 'https//...vercel' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
You can use those domains .railway and .vercel as they are on the public suffix list so they will get blocked by CORS.
You need to add your own domain that you own.
No, public suffix domain just don't set cookies
True
But still wont work and needs to be addressed, but this issue is because you havent updated ADMIN_CORS
Add your own domains:
store: yourdomain.com
backend: api.yourdomain.com
admin: admin.yourdomain.com
This will be needed
But still as Kasper said the issue is that you have not updated ADMIN_CORS
So you mean I need to own domains to get it working live? With those generated domains by Vercel etc, doesn't work?
You can try, but not sure if the cookie will be set. You may have trouble logging in into admin or customers logging in.
As for now you can set ADMIN_CORS to that generated vercel domain
To have the CORS error go away
But I did set it, it's set to Vercel deployed url, with .app ending.
with https and no trailing slash?"
yeah, I also tried both ways.
have you rebuilt/restarted backend?
so you mean every url server etc should be without / ending?
they are without it by default, but if I copy them, they come with / automatically.
Then you need to remove it when setting the env vars
But still most likely for production you will need your custom domain.
It's not a medusa limitation but how browsers work.
Okay, good to know, then its not worth even trying right now, I thought I could show it live in the school, but I think, then I need to show it locally.
Do you want to show the admin or store?
Both, I think
Have you tried just running the admin with the backend? Using serve config?
https://docs.medusajs.com/admin/quickstart#step-2-add-admin-to-medusa-configurations
It would be deployed on the backend domain at /app directory
Not sure if it works on Railway. It will need some resources.
For using the store without customers logging in, you won't need a custom domain either.
as cookies are not required
The admin that is deployed to vercel, is ejected one