Unhandled promise rejection Err: WebMethod request timed-out

We are calling a 3rd party api using {fetch}
The request is going to heroku
Heroku is returning the json

We are displaying the data in the repeater

If the data is being fetched and processed befor 14 seconds, the contents are displayed properly
If it is taking more than 14 seconds, then the error is being showed (Unhandled promise rejection Error: WebMethod request timed-out after 14 seconds… Did you forget to resolve a promise?)

The contents are coming in json, but cannot be displayed because of the timeout
We have searched all around the net to set the timeout, but couln’t find anything useful

May you all please help us out here?

Snippet of the code:

export function getResults(area,city,sdate,smonth,syear,edate,emonth,eyear) {
const url = ‘https://comparyd.herokuapp.com/cmp_json?area=‘+area+’&city=‘+city+’&startdate=‘+sdate+’&startmonth=‘+smonth+’&startyear=‘+syear+’&starthour=06&startminute=30&enddate=‘+edate+’&endmonth=‘+emonth+’&endyear=‘+eyear+’&endhour=06&endminute=30’;
console.log(“hello”);
var x = fetch(url, {method: ‘get’})
.then( function (response)
{
console.log(“ayush:”+response.status);
return response.json();
})
.then(json=>json)
. catch(function (err)
{
console.log(“Retrying as this error came:”+err);
});
console.log(‘world’);
return x;
}

Thanks in advance :slight_smile:

1 Like

I have the same problem. Did you find a solution for this timeout?

We were unable to find a solution to the problem. But, to reduce the time, we used parallel programming. In our case, we have used multithreading. This reduced the time to around 8 seconds.

Hi,

14 second time out is a fixed timeout for WebMethod responses. Currently, there is no way to increase it. The best thing to do is to try and make the services you rely on as fast as possible, parallelise calls if these are multiple.Timeouts aside, long transactions hurt user experience.

quatro anos depois estou aqui com o mesmo problema, já conseguiram resolver?