#Help with Heroku & Vercel (CORS)

14 messages · Page 1 of 1 (latest)

frozen pilot
#

Hello all,

I was able to get Medusa working locally and it's been great. I am trying to get it online so I can demo it to my partner but I've been having some difficulty with CORS and Heroku in particular. I used the nextjs-starter and the heroku auto deploy for the backend. The issue I'm having is as follows:

Storefront: https://skincandy.vercel.app/
Admin: https://skincandy-backend.vercel.app/
Backend: https://skincandy-230bb14ddb76.herokuapp.com/

I followed the docs and was able to get the majority of it working and hosted on Vercel, the issue is that I am unable to login to the backend and keep seeing CORS issues when I check the log in the browser. Also, Heroku seems to be crashing as well and not maintaining the server.

Here are the necessary environment variables for heroku:
ADMIN_CORS: https://skincandy-backend.vercel.app
STORE_CORS: https://skincandy.vercel.app
NODE_ENV: production
NPM_CONFIG_PRODUCTION: true

Here are the env variables for the storefront:
NEXT_PUBLIC_BASE_URL: https://skincandy.vercel.app
NEXT_PUBLIC_MEDUSA_BACKEND_URL: https://skincandy-230bb14ddb76.herokuapp.com
MEDUSA_ADMIN_BACKEND_URL: https://skincandy-230bb14ddb76.herokuapp.com

Here are the env variables for the admin:
MEDUSA_ADMIN_BACKEND_URL: https://skincandy-230bb14ddb76.herokuapp.com
ADMIN_CORS: https://skincandy-backend.vercel.app

Lastly, here are the logs from Heroku (Image attached). Appreciate any help i can get, thank you!!

grim trellis
#

remove the trailing slashes from cors

#

also it should be NPM_CONFIG_PRODUCTION

#

And please fix all the information here. It is impossible to deploy backend to vercel and your description says you did.

#

And you don't have any CORS issue. Your backend deployment doesn't work.

frozen pilot
frozen pilot
grim trellis
#

THen something is wrong with your deployment on heroku. It didn't succeed.

frozen pilot
grim trellis
#

Also disable autoRebuild and serve

robust lotus
#

Did you get it to work? Except for the deployment errors on heroku, I seem to be having the same issue your having. Hoping its just a simple misconfiguration, I just cant seem to find what it is I did wrong.

frozen pilot
robust lotus
#

Ok I went deep in a rabbit hole over this issue and finally fixed it a few minutes ago. I'm no expert but I'll shoot you a few suggestions when you get back to it if you'd like. Just lmk

quasi path
#

I'd appreciate this too, I'm having the same issue with Heroku