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

CORS error when signing as vendor on dashboard #43

Open
drewes opened this issue Jan 3, 2025 · 5 comments
Open

CORS error when signing as vendor on dashboard #43

drewes opened this issue Jan 3, 2025 · 5 comments

Comments

@drewes
Copy link

drewes commented Jan 3, 2025

Trying to get the vendor app configured. Signing in on the vendor app shows the following error:

dashboard/orders:1 Access to fetch at 'http://localhost:9000/vendor/sellers/me' from origin 'http://localhost:7001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I've checked the medusa CORS config and the registration works without returning a CORS error.

Debugging the /vendor/seller/me route returns a valid object.

Any suggestions on where I'm going wrong?

@drewes
Copy link
Author

drewes commented Jan 6, 2025

For anyone struggling with this. You need something like the following to the backend config file:

VENDOR_CORS=http://localhost:7001,http://localhost:5173,http://localhost:9000,https://docs.medusajs.com

@vholik
Copy link
Collaborator

vholik commented Jan 10, 2025

Yes, you're right. I've added vendor cors in the .env.template #46

@LukaszMielczarek
Copy link

I'm still getting the error, even though I've added VENDOR_CORS=... to .env file :/

Access to fetch at 'http://localhost:9000/auth/seller/emailpass/register' from origin 'http://localhost:7001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
index.ts:25445 

    POST http://localhost:9000/auth/seller/emailpass/register net::ERR_FAILED
HttpClient.customFetch @ index.ts:25445
HttpClient.request @ index.ts:25566
postSellerTypeAuthProviderRegister @ index.ts:49905
mutationFn @ auth.ts:18
...
        
   Uncaught (in promise) TypeError: Failed to fetch
at HttpClient.customFetch (index.ts:25445:71)
at HttpClient.request (index.ts:25566:17)
at Object.postSellerTypeAuthProviderRegister (index.ts:49905:12)
at Object.mutationFn (auth.ts:18:10)
...

Any ideas ?

@vholik
Copy link
Collaborator

vholik commented Jan 15, 2025

@LukaszMielczarek make sure you have http://localhost:7001 in the vendor cors variable

@hamudeshahin
Copy link

I have same cors error, in Medusa application it self!

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

4 participants