Getting TypeError: Failed to fetch error in Swagger UI

3,873 views
Skip to first unread message

Dimpy Adhikary

unread,
May 18, 2017, 7:31:53 AM5/18/17
to Swagger
Hi All,

I need help to resolve this swagger UI issue. I am hosting swagger UI locally. I have the swagger specification json pointing to my server.

When I try to send any request from Swagger UI, I am getting TypeError: Failed to fetch error all the time. But the request is actually successful and I could see the response in the browser console. I am able to run the curl command generated from the command prompt as well. I have downloaded swagger UI and using http-server --cors I am starting the server. I am opening the swagger UI using this Url http://127.0.0.1:8080/swagger-ui/swagger-ui/dist/. Note: the default http://petstore.swagger.io/v2/swagger.json is working fine. But if I browse my swagger spec file from the swagger UI and execute any request I am getting the above error all the time. My swagger specification file is present in the same /dist folder. Looking forward to get help from experts in this group.

Regards,
Dimpy

Ron Ratovsky

unread,
May 18, 2017, 12:10:59 PM5/18/17
to swagger-sw...@googlegroups.com

Can you share the spec you’re trying to load?

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dimpy Adhikary

unread,
May 22, 2017, 2:04:28 AM5/22/17
to Swagger
Hi Ron,

I am attaching one sample for your reference.

Regards,
Dimpy

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

magento.json

Dimpy Adhikary

unread,
May 22, 2017, 6:46:31 AM5/22/17
to Swagger
I am able to resolve it by enabling CORS.

Regards,
Dimpy
Reply all
Reply to author
Forward
0 new messages