emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.47k stars 4.21k forks source link

[3.2.0] Cannot read property 'parameters' of undefined #16705

Closed boris-petrov closed 6 years ago

boris-petrov commented 6 years ago

After upgrading from 3.1.2 to 3.2.0, we get the following error:

runtime.js:639 Uncaught TypeError: Cannot read property 'parameters' of undefined
    at Object.evaluate (runtime.js:639)
    at AppendOpcodes.evaluate (runtime.js:46)
    at LowLevelVM.evaluateSyscall (runtime.js:2896)
    at LowLevelVM.evaluateInner (runtime.js:2868)
    at LowLevelVM.evaluateOuter (runtime.js:2860)
    at VM.next (runtime.js:4788)
    at VM.execute (runtime.js:4773)
    at TryOpcode.handleException (runtime.js:3753)
    at UpdatingVMFrame.handleException (runtime.js:3923)
    at UpdatingVM._throw [as throw] (runtime.js:3658)
    at Assert.evaluate (runtime.js:730)
    at UpdatingVM.execute (runtime.js:3645)
    at RenderResult.rerender (runtime.js:3950)
    at RootState._this30.render (ember-glimmer.js:4086)
    at TransactionRunner.runInTransaction (ember-metal.js:1122)
    at InteractiveRenderer._renderRoots (ember-glimmer.js:4351)
    at InteractiveRenderer._renderRootsTransaction (ember-glimmer.js:4383)
    at InteractiveRenderer._revalidate (ember-glimmer.js:4423)
    at invoke (backburner.js:247)
    at Queue.flush (backburner.js:167)
    at DeferredActionQueues.flush (backburner.js:326)
    at Backburner._end (backburner.js:772)
    at MutationObserver.Backburner._boundAutorunEnd (backburner.js:484)

Please tell me if you need more information.

boris-petrov commented 6 years ago

Please ignore this. We're using the ember-template-compiler on the backend to compile some stuff and tried using version 0.35.0 with Ember 3.2.0 which caused this problem. Sorry for the confusion.

rwjblue commented 6 years ago

FWIW, you really should be using the file bundled with ember-source (and not use @glimmer/compiler directly). Ember adds a number of features which are not included in glimmer compiler via ast transforms that are automatically ran for each compiled template. If you use @glimmer/compiler directly it will definitely not emit the same output...

boris-petrov commented 6 years ago

@rwjblue - thanks for the information! We have this on the BE:

var compiler = require('@glimmer/compiler');

function main(template) {
    return JSON.parse(compiler.precompile(template));
}

And then we send this to the FE for use from Ember. You're saying that we should not do this but rather something like:

var compiler = require('ember-source/dist/ember-template-compiler.js');
// same code after that

Am I understanding you correctly?

rwjblue commented 6 years ago

Yes! Exactly!