Ember-inspector: Getting error in console when using Ember Inspector: Assertion failed: TypeError: Cannot read property 'constructor' of undefined

Created on 29 Dec 2016  路  11Comments  路  Source: emberjs/ember-inspector

trace:

Assertion failed: TypeError: Cannot read property 'constructor' of undefined
at controllerName (:4321:31)
at shortControllerName (:4338:16)
at _default.inspectController (:1679:71)
at _default.inspectOutlet (:1653:28)
at _default.makeOutletTree (:1397:34)
at _default.makeOutletTree (:1399:35)
at _default.buildOutletTree (:1367:31)
at _default.build (:1341:33)
at i.viewTree (:4686:33)
at :4658:27

https://github.com/emberjs/ember-inspector/blob/v2.0.4/ember_debug/view-debug.js#L282 (started here)
https://github.com/emberjs/ember-inspector/blob/v2.0.4/ember_debug/utils/name-functions.js#L41 (error occurred)

Ember version => 2.10.2
Ember-cli => 2.10.0
Chrome => 55.0.2883.95
Ember inspector => 2.0.4

Issue seems to be occurring only in chrome. Any idea ?

Most helpful comment

I had the same issue a couple of weeks ago with ember 2.11

The workaround I've used is to replace disconnectOutlet with render and pass it
an empty template.

Before:

closeModal() {
  this.disconnectOutlet({
    outlet: 'modal',
    parentView: 'application'
  });
}

After

closeModal() {
  this.render('modals/nothing', {
    outlet: 'modal',
    into: 'application',
    controller: 'application'
  });
}

All 11 comments

Hi, is there a way for me to reproduce this?

@teddyzeenny it seems to be related with the way, we render modal. After closing a modal, if I try to move to another route, the error being thrown.

i will try to reproduce with a simple application and confirm.

You may be trying to call functions on destroyed objects?

@locks As far as i can say, No.

After closing the modal, wherever i click, its landing in the error.

_this._runExpiredTimers(); => This seems to be a starting point in the trace.

 _installTimerTimeout() {
  ...
  this._timerTimeoutId = this._platform.setTimeout(this._boundRunExpiredTimers, wait); => which calls _runExpiredTimers();
}

The above line called when i render the modal-component. Issue seems to be related with setTimeout.

@karthiick if this is the modal, this._boundRunExpiredTimers is likely to be called on a destroyed object unless you guard for that. I suggest checking out ember-concurrency or ember-lifeline to deal with these sort of tasks.

I'm experiencing the same issue after closing a modal using Ember Inspector v2.0.4 in Chrome v55.0.2883.95 (64-bit).

Ember versions

DEBUG: Ember : 2.10.0
DEBUG: Ember Data : 2.10.0
DEBUG: jQuery : 3.1.1

Stacktrace

Uncaught TypeError: Cannot read property 'constructor' of undefined
at controllerName (:4321:31)
at shortControllerName (:4338:16)
at _default.inspectController (:1679:71)
at _default.inspectOutlet (:1653:28)
at _default.makeOutletTree (:1397:34)
at _default.makeOutletTree (:1399:35)
at _default.buildOutletTree (:1367:31)
at _default.build (:1341:33)
at Class.viewTree (:4686:33)
at :4658:27
at fn (index.ts:8)
at invoke (index.ts:8)
at Queue.flush (index.ts:8)
at DeferredActionQueues.flush (index.ts:8)
at Backburner.end (index.ts:8)
at Backburner.run (index.ts:8)
at Backburner._runExpiredTimers (index.ts:8)
at Backburner._boundRunExpiredTimers (index.ts:8)

Also getting this on Ember 2.11.1

I ran into this today on Ember 2.11.2 I tracked it down to a 'this.disconnectOutlet' command in our application route file. I've tried to make a failing twiddle, but as of yet I can't make it fail.

I was able to workaround it by removing the disconnectOutlet command and instead using an IF in the template to control the removal of the rendered {{outlet}}

I had the same issue a couple of weeks ago with ember 2.11

The workaround I've used is to replace disconnectOutlet with render and pass it
an empty template.

Before:

closeModal() {
  this.disconnectOutlet({
    outlet: 'modal',
    parentView: 'application'
  });
}

After

closeModal() {
  this.render('modals/nothing', {
    outlet: 'modal',
    into: 'application',
    controller: 'application'
  });
}

@safeforge Thanks, I ran into the same issue and fixed it with your solution.

As of today, bug still exists (Chrome 58.0.3029.110 (64-bit), Ember Inspector 2.0.6).
@safeforge Thanks, your solution also worked for me.

Was this page helpful?
0 / 5 - 0 ratings