Weird error in Kadira

I’m getting some errors in Kadira that I’m not sure how to trace and debug. This is just one example:

Where does one even begin with this? I’m not seeing any errors when I test the heck out of my app. Here’s another weird one:

Error: ReferenceError: Can’t find variable: Spacebars
Error:
at window.onerror (http://xxxx/9333b8667d28532ef8687f47073ed75d35eb9739.js:107:17391)

How do I tackle strange erorrs like this?

1 Like

For the first error, it has anonymous in it’s stack so it must have happened inside an eval. Also look for new Function('...') which is also very similar to eval. For the second error, start with a search for Spacebars in your code.

We can use window.onerror to catch errors when they are not caught by any try{} blocks. The kadira package uses this (amongh other methods) to catch error events. You can read more about it here.

Javascript stacktraces doesn’t have async functions. So it’s most likely that this error happened in the root level of a javascript file or inline script (not inside any function). At Kadira we’re using zone.js to collect stacktraces across async functions. Do you have zone.js enabled? If you do, I guess the error happened before kadira and zonejs packages are loaded in the browser.

When looking for the source for the second error, I’d also check all inline scripts, async callbacks (setTimeout, …) and script directly in the javascript file which are a bit rare in Meteor apps.

No, that’s the funny thing. I’m not referencing Spacebars anywhere in my code. This error is basically saying that Blaze didn’t even initialize which doesn’t make sense. And there are no evals or anything like that. These errors are totally out there.

Maybe these are just people leaving the site before it finishes loading, or they’re hitting reload.