-
Notifications
You must be signed in to change notification settings - Fork 670
Closed
Description
Hi,
I’m running Polar locally for contributing and I’m hitting CORS errors when trying to create products or discounts from the frontend.
What I see
When creating a product (src/hooks/queries/products.ts):
Access to fetch at 'http://127.0.0.1:8000/v1/products/'
from origin 'http://127.0.0.1:3000' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
POST http://127.0.0.1:8000/v1/products/ net::ERR_FAILED 500 (Internal Server Error)
Uncaught (in promise) TypeError: Failed to fetch
at Object.mutationFn (products.ts:105:18)
...
When creating a discount (src/hooks/queries/discounts.ts):
Access to fetch at 'http://127.0.0.1:8000/v1/discounts/'
from origin 'http://127.0.0.1:3000' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
POST http://127.0.0.1:8000/v1/discounts/ net::ERR_FAILED 500 (Internal Server Error)
Uncaught (in promise) TypeError: Failed to fetch
...
Debugging done
- Tried sending the same request via Postman → still fails.
- Tried setting
CORS_ORIGINSto"*"→ still blocked by the browser.
Additional notes
- Already asked for help on Discord but didn’t get a response.
- This happens only on POST requests (
/v1/products/,/v1/discounts/). - Running frontend on
127.0.0.1:3000and backend on127.0.0.1:8000.
Could you clarify if this is a misconfiguration on my side, or if there’s an issue with how CORS is applied on POST endpoints locally?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels