#Cors error just as documentation says

33 messages · Page 1 of 1 (latest)

marsh phoenix
#

I'm experiencing the error as descried in the cors issues documentation: https://docs.medusajs.com/troubleshooting/cors-issues/
My issue is that I have everything on default my cors is setup as explained in the docs:
const ADMIN_CORS = process.env.ADMIN_CORS || "http://localhost:7000,http://localhost:7001";

// CORS to avoid issues when consuming Medusa from a client
const STORE_CORS = process.env.STORE_CORS || "http://localhost:8000";

I console.log both of these to ensure the localhost is correct. I can confirm I'm running on 8000 and 7000 but I still get the error. Any idea why this is happening? Node 14

If you are experiencing connection issues when trying to access your Medusa server from a storefront, it is most likely due to Cross-Origin Resource Sharing (CORS) issues.

deep vortex
#

Are these deployed to cloud servers like AWS? Then you need to use those IPs

marsh phoenix
#

No local on my local system @deep vortex

knotty zinc
#

Can you share screenshot?

marsh phoenix
#

@knotty zinc yes here goes

#

same error as in docs

#

I have my .env file set to the correct urls

#

and can confirm both work

#

on those ports

knotty zinc
marsh phoenix
#

I switched to 127 to test localhost 8000 didn't work either

#

hold on let me show you

knotty zinc
#

Try cleaning cookies

marsh phoenix
#

Just tried that again no success

#

from my network tab you can see it's the correct url trying to access it

marsh phoenix
#

I've even tried streaming port 8000 through ngronk

#

while changing it in the .env file

exotic quartz
#

Could you try and add console.log(JSON.stringify(module.exports, null, 2)); to the end of your medusa-config.js and validate that the CORS settings are actually part of the export?

marsh phoenix
#

@exotic quartz

#

{
"projectConfig": {
"database_database": "./medusa-db.sql",
"database_type": "sqlite",
"store_cors": "http://localhost:8000",
"admin_cors": "http://localhost:7000"
},
"plugins": [
"medusa-fulfillment-manual",
"medusa-payment-manual"
]
}

#

this was the console.log

marsh phoenix
#

localhost:9000 products loads fine

restive dew
marsh phoenix
#

unfortunately that didn't work either @restive dew

upbeat quartz
#

Did anyone solve this? I'm having the same issue but with a custom endpoint (regular API calls to /store and /admin are working fine)