Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No response from server" when error occurs #2545

Closed
peacemakr opened this issue Nov 30, 2016 · 7 comments
Closed

"No response from server" when error occurs #2545

peacemakr opened this issue Nov 30, 2016 · 7 comments

Comments

@peacemakr
Copy link

version v2.2.8 of Swagger-UI

I am getting "No response from server" only when I test with incorrect parameters and Express's error handler gets called.

The browser returns results as expected. Also, in the Chrome network tab, I can see the response code as 400 (which is correct). However, the UI shows response code 0.

Response Body: no content
Response Code: 0
Response Headers
{
  "error": "no response from server"
}

However, the successful calls are displayed without any issues.

@vfedoriv
Copy link

Maybe this answer 2584 can help you.

@ben31414
Copy link

Hi,
I have the exact same same issue. For valid requests the response body is shown, but when there is an error it shows the same message as peacemakr showed above.

The responses are valid json, for example:

{
"message": "Forbidden"
}

The response-headers look like this:
Content-Length: 24
Content-Type: application/json
Date: Thu, 23 Feb 2017 12:29:13 GMT
Via: 1.1 ...
X-Amz-Cf-Id: ...
X-Cache: Error from cloudfront
X-Firefox-Spdy: h2
x-amzn-errortype: ForbiddenException
x-amzn-requestid: ...

Does anybody know how to fix this?

@okneloper
Copy link

@ben31414 If the domain of your API in your swagger.json does not match that which swagger ui is hosted on, the response might be lacking CORS headers? The api could be only adding them to the successful responses?

"error": "no response from server" is the error you get when the request is blocked by the CORS policy.

@ben31414
Copy link

@okneloper thanks a lot!
That was a very good and helpfull hint!

For other people with the same problem, using the AWS API-Gateway: it seems that you have to add the header "access-control-allow-origin" to the method response of every error message and set it's value in the integration response to "'*'".

@webron
Copy link
Contributor

webron commented Mar 24, 2017

This should no longer be an issue with 3.X.

@webron webron closed this as completed Mar 24, 2017
@kumarz
Copy link

kumarz commented Feb 23, 2018

@webron,
I see springfox swagger ui has the latest version as 2.8. may i please know 3.x version of what you are referring too ?

@heldersepu
Copy link
Contributor

heldersepu commented Feb 23, 2018

@kumarz Springfox is using Swagger-UI version 3.9.1 that is recent but not latest:
https://github.com/springfox/springfox/blob/master/springfox-swagger-ui/build.gradle
...and yes 3.9.1 is part of the 3.x family

The issue described here should not be happening on Springfox 2.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants