Forum Discussion

arjunrajas1231's avatar
arjunrajas1231
New Contributor
3 years ago

error while deployed locally Failed to fetch. Possible Reasons: CORS Network Failure

I tried deploying Swagger locally and i was able to open it in browser with the given below url

 

http://192.168.56.1:3001/ 

and also used the Yaml code as given below

swagger: '2.0'
info:
description: A Simple IP Address API
title: ipify
version: v1
host: "192.168.56.1:3001"
schemes:
- https
- http
basePath: /
consumes:
- application/json
produces:
- application/json
paths:
/hello:
x-swagger-router-controller: hello_world
get:
tags:
- hello_world
operationId: hello
parameters:
- name: name
type: string
in: query
description: the name
responses:
"400":
description: "Invalid ID supplied"
"404":
description: "Pet not found"
"405":
description: "Validation exception"

 

when testing it in Swagger UI i get the error as given below in the screen shot 

please help to overcome this error

2 Replies

  • Hi arjunrajas1231,

     

    Can you describe how did you "deployed Swagger locally"? Did you use npm scripts from swagger-ui repository  (`npm run start`) or are you running your own server where built swagger-ui is being served?

    From the information that I currently have I don't think CORS is causing requests failure. I can clearly see that you're doing request from the same IP as the swagger-ui is being served. 

    Could you also open developer console in your browser and inspect how the actual request was made and what was the actual response?