Jsonp request has been timed out all the time

write a js, in the webpack project for vue to use.
whether it is on jsonp (npm or fetch-jsonp (package on github), an error is reported.
js is as follows:

    fetchJsonp(resourceUrl).then(function (response) {
      return response.json()
    }).then(function (json) {
      console.log(json)
    }).catch(function (ex) {
      console.error(ex)
    })

saw that the request was sent, and the result was obtained, but the error was reported all the time:

Error: JSONP request to ******** timed out
    at eval (fetch-jsonp.js?4706:85)
Mar.10,2021

where did you get this fetchJsonp?


timeout is a backend service problem. It has nothing to do with the front end.


the last reason is why


jsonp (url, {timeout: 20000})
default is 5000, changed to 20000, it's OK. Multiple jsonp requests are easy to cause congestion


I also encounter this kind of situation. I set a 10s timeout regardless of whether it is successful or not. It should be a timeout when there is no response.

Menu