ageddesi/Mocked-API

API Access from Swagger (CORS error) / 502 error

computamike opened this issue · 3 comments

Describe the bug
It seems that CORS configuration is preventing the production API site from serving API results to swagger front end, or a sample codepen(thanks swampdolphin on discord).

To Reproduce
Steps to reproduce the behavior:

  1. Go to swagger
  2. Execute some of the endpoints
  3. Get CORS error (occasionally?)
  4. For a more consistent approach : try this codepen
  5. See error screenshot

Expected behavior
CORS errors should not probably be thrown when consuming the API from codepen

Screenshots
image

Additional context
The stability of the API has been problematic - sometimes throwing a 502 error
image

Thank you for this. I have taken a look at the request being made in the codepen and we were not doing the fetch correctly I believe. Here is a one working.
image

In response the 502. I have provided that request ID to our hosting provider so they can look into this and let me know what is causing the issue.

Hi @computamike,
I have found the issue that is causing CORS in swagger, But as I can see the website https://api.mocked-api.dev/ is no longer functional should I raise pr for the fix?
— Vaibhav

Hi @VaibhavGagneja If you have the fix that would be most welcome. We are just trying to sort out a hosting provider at the moment.