Randomly occurs: "TypeError: Cannot read property 'invalidate' of undefined"

On what seems to be random occasions, when a user on my website tries to answer a question on the quiz page, the following error occurs:

TypeError: Cannot read property 'invalidate' of undefined
at Tracker.Dependency.changed (tracker.js:388)
at ReactiveVar.set (reactive-var.js:82)
at null. (builtins.js:22)
at view.js:191
at Function.Template._withTemplateInstanceFunc (template.js:437)
at view.js:190
at Object.Blaze._withCurrentView (view.js:523)
at viewAutorun (view.js:189)
at Tracker.Computation._compute (tracker.js:294)
at Tracker.Computation._recompute (tracker.js:313)

When the error is present, the current template SOMETIMES doesn’t render properly (when a user answers a question, the answer they clicked either turns red if incorrect, or green if correct). More often than not, the template renders fine with the updated inserted classes (reactive template with handlebars). I don’t know why this occurs, and I am not entirely sure what this error even means so if someone could point me in the right direction, that would be great!

Note: this error seems to only occur when using Chrome. Here’s a link to the post i put up on the Meteor github page. Another user has run into this problem too. In Firefox, the following warning gets displayed:

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

but oddly enough, the page renders fine, unlike in Chrome.

4 Likes

+1

For me it happens on autoform templates, specifically type="update" - though maybe it’s unrelated(?)

We got this too. I thought it was our code, but then it started appear all over, and I accidentally saw it in the JS console while browsing Crater.io as well.

Some internal Blaze change?

It’s also happening to me and my development group. Randomly!

Yup, this appears a lot for us too. Hard to find a common pattern.

We had the same error. It was triggered almost always when I changed the session defining active language. After debugging (too) many hours, I found this block to be the cause of errors.

{{#if image.URL}}
  {{image.URL}}
{{else}}
  fallback-URL
{{/if}}

I added {{#if image}}{{/if}} around it because I thought image object is not loaded yet, but it did not help. Errors went away eventually when I removed everything and kept only {{image.URL}}.

This does no make any sense as:
a: this block has been there many months before and errors appeared later
b: language session and image are not connected

A complete mystery

maybe related to https://github.com/meteor/meteor/issues/4793