Ask a Question

swagger ui time out error

vishakhr
New Contributor

swagger ui time out error

Hi Team,

 

We am using swagger UI integrated with our dev portal .. when using the "TRY OUT" option, our consumers are encountering  a "REQUEST TIME OUT 504" error ...the same end point works fine in POSTMAN with no time out error... how should i configure the TIMEOUT to be increased to minimum of 60sec atleast.

 

My code goes here:

======================================

window.swaggerUi = new SwaggerUi({
spec: specObj,
validatorUrl: null,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
ReadTimeout: 120000,
ConnectTimeout: 120000,
onComplete: function(swaggerApi, swaggerUi) {....................................

5 REPLIES 5
ponelat
Staff

Re: swagger ui time out error

Hi @vishakhr 

 

Timeouts can be because the consumer aren't able to reach the backend servers. 

If you can reproduce it, take a look at the network logs in the browser's console to see what request is being made. And verify that it is the right request.

 

vishakhr
New Contributor

Re: swagger ui time out error

Hi @ponelat , Thanks for quick response, the request is able to reach backend server and our KIBANA logs is able to show the response time also... but since its taking around 20seconds, the TRYOUT option from swagger UI is showing "TIMEOUT" but its working fine from POSTMAN... hence our consumers are worried... let me know how can I increase the TIMEOUT  value from my swagger UI code

ponelat
Staff

Re: swagger ui time out error

@vishakhr  are you using the Docker image for SwaggerUI? 

vishakhr
New Contributor

Re: swagger ui time out error

@ponelat 

not Docker image, we are importing swagger-ui like this :

 

{% cdn_asset /swagger-ui/2.2.10/swagger-ui.js %}
{% cdn_asset /swagger-ui/2.2.10/swagger-ui.css %}
ponelat
Staff

Re: swagger ui time out error

@vishakhr okay that might be an older version of SwaggerUI.

The current stable version is 3.52.3, with 4.0.0-rc (release candidate) becoming stable soon.

 

There is also no timeout functionality that I'm aware of in the new versions (version 2.x is so old, I can't recall that at all). But the docker container uses nginx which does have a timeout (which is why I asked). Also 504 isn't a browser error but a server error, so it's a server component somewhere in the chain of things. 

 

Try update to the latest version of SwaggerUI to see if  that helps.

Else look at the network logs in the browser to see the request being made, and double check to see if it matches the request being made by Postman (or cURL).

cancel
Showing results for 
Search instead for 
Did you mean: