1

I try to debugg a JavaScript error which mostly happens on the first load page

2017-06-27 10:05:12.480 /static/version1498550705/frontend/Example/default/en_US/Ves_ImageSlider/js/owl.carousel.min.js:1 Uncaught TypeError: Cannot read property 'fn' of undefined
    at /static/version1498550705/frontend/Example/default/en_US/Ves_ImageSlider/js/owl.carousel.min.js:1
    at /static/version1498550705/frontend/Example/default/en_US/Ves_ImageSlider/js/owl.carousel.min.js:1
2017-06-27 10:05:12.548 (index):285 Uncaught TypeError: owl.owlCarousel is not a function
    at HTMLDocument.<anonymous> ((index):285)
    at fire (jquery.js:3232)
    at Object.fireWith [as resolveWith] (jquery.js:3362)
    at ready (jquery.js:3582)

This question is not so much about the error itself - it is properly to broad.

I am just asking how I can try to reproduce this bug properly to tackle it.

Clearing cache and Inkognito window does not really help to reproduce this. But it happens more often then only sometimes.

How can I debug such a "Heisenbug" ?

EDIT: The problem might be random in around 10% probability ... when hitting F5 (no cache clear) a number of times, it happens like every third time.. Still hard to debug. Maybe a timing issue?

Alex
  • 32,506
  • 16
  • 106
  • 171
  • What if you setup something automated, like [Casper.js](http://casperjs.org/), to keep loading the page over and over, so then in the grand scheme of things, if you haven't encountered the bug in a while the last attempt to fix it probably worked? – Olian04 Jun 27 '17 at 14:47
  • Maybe it is caused by timing. You could try to enable throttling. Chrome has this option in the "Network" tab. Switch to GPRS and retry. – PiTheNumber Jun 28 '17 at 08:41

1 Answers1

0

At the end of the day, the problem was require js where two libraries were loaded, the second one depending on Jquery. I was able to fix it with a shim configuration.

See also RequireJS order of dependencies

Alex
  • 32,506
  • 16
  • 106
  • 171