Understanding meteor exceptions

Many times I get issues while developing, however I never understand where the issue was thrown and how to detect it.
Can someone please explain me how to track an issue according to Meteor’s stack trace? Is there a better method for detecting the issues?
attrs.js/AttributeHandler.prototype.update@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:976:13 attrs.js/ElementAttributesUpdater.prototype.update@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1302:15 updateAttributes@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1463:19 viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1778:18 template.js/Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:3575:14 viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1777:29 view.js/Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:2109:12 viewAutorun@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1776:18 _compute@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:331:38 Computation@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:228:12 tracker.js/Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:601:11 view.js/Blaze.View.prototype.autorun@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1787:22 materializeTag@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1469:39 materializeDOMInner@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1373:28 materializer.js/Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1340:22 materializer.js/Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1349:7 doMaterialize@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1932:38 tracker.js/Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:625:12 doRender@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1930:17 viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1778:18 template.js/Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:3575:14 viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1777:29 view.js/Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:2109:12 viewAutorun@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1776:18 _compute@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:331:38 _recompute@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:348:16 tracker.js/Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:515:14 onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:515:23

First thing is to separate the lines of the stack trace to make it easier to read:

attrs.js/AttributeHandler.prototype.update@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:976:13
attrs.js/ElementAttributesUpdater.prototype.update@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1302:15
updateAttributes@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1463:19 
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1778:18 
template.js/Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:3575:14
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1777:29 
view.js/Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:2109:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1776:18 
_compute@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:331:38 
Computation@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:228:12 
tracker.js/Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:601:11
view.js/Blaze.View.prototype.autorun@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1787:22
materializeTag@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1469:39 
materializeDOMInner@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1373:28 
materializer.js/Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1340:22
materializer.js/Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1349:7
doMaterialize@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1932:38 
tracker.js/Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:625:12
doRender@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1930:17 
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1778:18 
template.js/Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:3575:14
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1777:29 
view.js/Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:2109:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:1776:18 
_compute@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:331:38 
_recompute@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:348:16 
tracker.js/Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=a51bf8f2995265823e1384a05b2c1851bddee036:515:14
onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:515:1234:

Now looking at the first line:

attrs.js/AttributeHandler.prototype.update@http://localhost:3000/packages/blaze.js?hash=2aa6f0f3b9cff09a60c7b659375479dd4e27e8af:976:13

We can see that the error originated in Blaze, when it was trying to update an attribute on an element. You can see that the name of the function that threw the error was AttributeHandler.prototype.update, and in the location, it points to packages/blaze.js

Unfortunately Blaze doesn’t give very descriptive errors, as you’ve discovered, so I put this down to blaze being opaque rather than saying anything about the skill of the developer.

Next I would scan down the list of files in the stack trace looking for app code, to figure out which of my lines has caused the error.
In this case, there is no app code, it’s framework all the way down.

Next lets look at why anything ran at all, if it hasn’t touched app code. The last function in the stack is onGlobalMessage:

onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:515:1234:

Which usually means it’s responding to a websocket message, which either means a subscription, or the result of a method changing a document that Blaze is watching for reactive re-rendering.

So the next question is what event preceded the error?
One way to check is to look in the network panel for the last websocket message (or use the Meteor devtools extension to look at the last DDP message)

I would also set the debugger to pause on errors, or add your own breakpoint in AttributeHandler.prototype.update and try to trigger the error again, so you can see what the HTML element is and what attribute is being changed.

From there, you will need to examine the change that triggered the failed re-render and think about what part of this is linked to the HTML attribute, then tweak your template or helpers to cover this case

1 Like