Skip to content

CORS error when running Polar locally for contributing #6805

@Manas-Kenge

Description

@Manas-Kenge

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_ORIGINS to "*" → 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:3000 and backend on 127.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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions