Developing for Splunk Enterprise
Highlighted

broken exception handling in web framework views

SplunkTrust
SplunkTrust

I'm not sure if this is a common thing, or if it reflects something that I've somehow setup weirdly, but if pretty much anything is out of whack in my SplunkJS views, I get an uncaught javascript exception "e is undefined", typically in headerview.js line 1 character 152,155. Sometimes an "e is indefined" exception will show up elsewhere though, like in mvc.js.

Within headerview.js, the expression that throws it is almost always "e.fn.carousel" if that helps, and peeking inside the code, it's part of Bootstrap Carousel.

When this occurs, which is extremely often, it really hampers development. You're making progress and then suddenly you hit a brick wall and unless there's an obvious culprit you have to just slowly back out changes until it goes away, then by looking more closely at the most recently-backed-out change you can figure out what it didn't like.

Is there some workaround I can do to make the splunkjs framework handle it's exceptions reliably? Does anyone have any ideas to investigate or troubleshoot?

I'm running Splunk 6.2.2 on Windows. Thanks in advance.

0 Karma
Highlighted

Re: broken exception handling in web framework views

SplunkTrust
SplunkTrust

First, you are running on windows. lol j/k. I've encountered this problem using the Web Framework native to Splunk, not specifically the SDK. If I forget a single ; or ), the mvc spits errors because of it, and it takes some digging to figure out I missed something in syntax of my view. I'm curious to see how you are calling your views, and in which context (HTML/Django/External/Simple XML). I haven't hit the carousel error yet, I actually hadn't seen that in the code for some reason.

Highlighted

Re: broken exception handling in web framework views

SplunkTrust
SplunkTrust

Thanks Alacer - predictably it ended up being something lame, that I was using jquery without explicitly listing it in require dep's. See my answer here. If a few other people fall into the same pit maybe this answer will help them out.

Highlighted

Re: broken exception handling in web framework views

SplunkTrust
SplunkTrust

It seems to have been a race condition between jquery and something, maybe backbone. At some point i noticed that my code wasn't specifically putting "jquery" in it's require dependencies. Since I added that, I haven't seen this error any more.

Something at a deeper level of course was loading jquery, and most of the time unless you do something to tilt the race, the race condition would work out fine. Conversely when I'd make some addition that exacerbates the problem it'd fail reliably, and then I'd back out my changes and conclude "hmm... it doesn't like it when I do this in that particular way".

Dependency issues are solved! Long live dependency issues!