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

Deployed medusajs admin panel/api on my AWS EC2 instance and receiving CORS error whenever trying to login #7044

Open
moheldesoqy opened this issue Apr 9, 2024 · 2 comments

Comments

@moheldesoqy
Copy link

Hello!

I recently deployed my my medusa backend, as in the admin panel and api to my EC2 instance, first built the docker image for the project, then ran that image on EC2 after pushing it.

Tested the url for my ec2 instance for both the admin panel and the api which are at port 7001 & 9000, respectively, and both of them are working, made api requests to the api on my ec2 and it worked perfectly, and went on the admin panel login page and it also worked, however whenever i try to login i get this error on the network tab:

cross-origin resource sharing error preflightmissingalloworiginheader

also attached a screenshot

I checked the cors medusajs page but it didn't help, does it relate to deploying the storefront too even though im not using it? help appreciated

System information

Medusa version: 1.20.2
Database: Postgres
Operating system: MacOS Sonoma 14.1.2
Browser: Google Chrome

Screenshot 2024-04-09 at 9 34 50 PM
@hadicph
Copy link

hadicph commented Apr 9, 2024

Did you set the ADMIN_CORS environment variable for the deployment?

@moheldesoqy
Copy link
Author

Did you set the ADMIN_CORS environment variable for the deployment?

it worked yes, i was deploying my docker image with "npm run dev" deploying the project in development build, but medusa reads the ADMIN_CORS from the production environment file right away with "npm run start" because of the hardcoded "localhost" inside of the medusa plugin

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

No branches or pull requests

2 participants