barba: Uncaught (in promise) Error: xhr: HTTP code is not 200

Hello,

Firstly, this library is ruddy belting, top draw stuff, so many thanks…

Anyhow, everything is working as expected but i’m getting the same error again and again and it seems to be quite random.

app.js:2995 Uncaught (in promise) Error: xhr: HTTP code is not 200
    at XMLHttpRequest.req.onreadystatechange 
req.onreadystatechange @ app.js:2995
app.js:2995 Uncaught (in promise) Error: xhr: HTTP code is not 200(…)req.onreadystatechange @ app.js:2995

It doesn’t break my site, or cause any issues that a non dev user would see, but I’d quite like to get to the bottom of what’s causing it.

Any tips on debugging this?

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I may have had some luck with this issue by passing a larger value to the XHR Timeout. The default is 5000.

    Barba.Utils.xhrTimeout = 10000

Hi, @luruke just thought I’d let you know that I have been getting the same issues on a particular PC on localhost. At first I thought it’s something to do with barba.js, however it worked on a simple example using a HTML pages.

I have just tried it out on a live WordPress site: http://tchc.com.mt/ and it worked without any issues. It just happens the localhost I’m using is a bit slow, I tried it out on another PC on localhost and it worked as well.

So it does seem to be an issue when the request takes a while. Not sure if this helps you out in any way.

cartogram… first, thanks for your idea of modifying xhrTimeout parameter, but…

Firstly, i tried with 10000 like you say, however, my transition did not work fine 100%… (my script takes 15 seconds to respond, forced by using usleep(15 * 1000000)😉

Finally, after several attempts, I tried setting 0 and… voila!, all worked!!

I have no idea if if’s the right solution, but it works for me… however, plugin’s developers should say something about it…

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout

Hi @luruke ,

A screenshot of the headers :

capture d ecran 2016-12-02 a 18 47 19

It seems to happen when the page is slow to be returned, so switching on network throttling (GPRS) along with prefetching produces the same error consistently.