emberjs / ember.js

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

[Bug] Some addons fail ember:try scenarios with ember-release (3.25) with loc$$1.sliceStartChars is not a function #19432

Open tylerturdenpants opened 3 years ago

tylerturdenpants commented 3 years ago

🐞 Describe the Bug

Test fail because as of this writing loc$$1.sliceStartChars is not a function. Going deeper

πŸ”¬ Minimal Reproduction

This pull request shows the error https://github.com/adopted-ember-addons/ember-light-table/pull/685

πŸ˜• Actual Behavior

Going deeper into the stack

πŸ€” Expected Behavior

It passes tests like all versions before and after ember-source 3.25

βž• Additional Context

Full stack trace:

  - broccoliBuilderErrorStack: TypeError: loc$$1.sliceStartChars is not a function
    at ElementNormalizer.classifyTag (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14700:32)
    at ElementNormalizer.ElementNode (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14510:23)
    at StatementNormalizer.normalize (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14361:52)
    at /home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14088:25
    at Array.map (<anonymous>)
    at normalize (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14087:67)
    at precompileJSON (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:6070:44)
    at precompile (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:6110:27)
    at Object.precompile (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:20344:37)
    at Object.template (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-font-awesome/node_modules/ember-cli-htmlbars/utils.js:29:40)
  - code: [undefined]
  - codeFrame: loc$$1.sliceStartChars is not a function
  - errorMessage: ember-font-awesome/components/fa-icon/template.hbs: loc$$1.sliceStartChars is not a function
        in /tmp/broccoli-6377QHsgFLGoZe2W/out-221-funnel_funnel_ember_font_awesome_addon
        at broccoli-persistent-filter:TemplateCompiler
  - errorType: Template Compiler Error
  - location:
    - column: [undefined]
    - file: ember-font-awesome/components/fa-icon/template.hbs
    - line: [undefined]
    - treeDir: /tmp/broccoli-6377QHsgFLGoZe2W/out-221-funnel_funnel_ember_font_awesome_addon
  - message: ember-font-awesome/components/fa-icon/template.hbs: loc$$1.sliceStartChars is not a function
        in /tmp/broccoli-6377QHsgFLGoZe2W/out-221-funnel_funnel_ember_font_awesome_addon
        at broccoli-persistent-filter:TemplateCompiler
  - name: Error
  - nodeAnnotation: [undefined]
  - nodeName: broccoli-persistent-filter:TemplateCompiler
  - originalErrorMessage: loc$$1.sliceStartChars is not a function
  - stack: TypeError: loc$$1.sliceStartChars is not a function
    at ElementNormalizer.classifyTag (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14700:32)
    at ElementNormalizer.ElementNode (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14510:23)
    at StatementNormalizer.normalize (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14361:52)
    at /home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14088:25
    at Array.map (<anonymous>)
    at normalize (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:14087:67)
    at precompileJSON (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:6070:44)
    at precompile (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:6110:27)
    at Object.precompile (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-source/dist/ember-template-compiler.js:20344:37)
    at Object.template (/home/travis/build/adopted-ember-addons/ember-light-table/node_modules/ember-font-awesome/node_modules/ember-cli-htmlbars/utils.js:29:40)
tylerturdenpants commented 3 years ago

@rwjblue let me know if you need anything else. As a reminder, more code searching only finds the function sliceStartChars in glimmer

rwjblue commented 3 years ago

I think this is due to

https://github.com/cibernox/ember-ast-helpers/blob/4022ed036228e4210438b37fea3c4ed78420036e/lib/build-time-component.ts#L306

syntax.builders.element doesn't support that style of invocation, it is implemented here:

https://github.com/glimmerjs/glimmer-vm/blob/ddb199a88d0ab82e8ac914d3d349c8f2815d462f/packages/%40glimmer/syntax/lib/v1/public-builders.ts#L196-L205

rwjblue commented 3 years ago

The builders.element method used to support that style of invocation, this is the implementation as of Ember 3.24

https://github.com/glimmerjs/glimmer-vm/blob/v0.65.2/packages/@glimmer/syntax/lib/builders.ts#L274-L339

rwjblue commented 3 years ago

Since these builders are all private API anyways (and we have a few other significant regression issues to deal with), I doubt I'll have the time to dig in and fix it myself. I do think the easiest fix is to update the ember-ast-helpers to use the new syntax, but if someone has the time to make a PR to glimmerjs/glimmer-vm to support the older syntax I'm happy to review + land + back port.

tylerturdenpants commented 3 years ago

@rwjblue I'm only taking a quick glance here (as my son uses me as a human jungle gym) and it looks like this is a easy as transferring the old invocation code to the the most up to date code. Am I in the ball park? If so I can make some time to knock this out.

rwjblue commented 3 years ago

it looks like this is a easy as transferring the old invocation code to the the most up to date code. Am I in the ball park?

Ya, that is definitely possible.

stfnio commented 3 years ago

@rwjblue I'm only taking a quick glance here (as my son uses me as a human jungle gym) and it looks like this is a easy as transferring the old invocation code to the the most up to date code. Am I in the ball park? If so I can make some time to knock this out.

Would be really cool if you can do that. The app on 3.25.3 just refuses to start because of that.

Hujun commented 3 years ago

same problem with ember-font-awesome

trevordevore commented 3 years ago

FWIW - I can't build an ember project that uses ember-font-awesome with any version after 3.20. I get loc$$1.sliceStartChars is not a function when I use ember b after upgrading the project using ember-cli-update --to 3.21 (or 3.22, 3.23, 3.24, or 3.25).

liancastellon commented 3 years ago

@trevordevore The fix on ember-ast-helpers, to something like this:

return this.syntax.builders.element(this.tagName, {attrs: this.elementAttrs, modifiers: this.elementModifiers, children: this.elementChildren});

It works! - but you will get another "cant find length on undefined" somewhere else (because some node variable wont have a type property, etc). So, it seems a more comprehensive fix is needed.

trevordevore commented 3 years ago

Thanks for the info @liancastellon. I ended up removing ember-font-awesome from my app and it is now building with Ember 3.25.

sovietspaceship2 commented 3 years ago

Any updates on this?

waihon commented 2 years ago

May I know any updates on this?

I have an Ember 3.28.1 project with "ember-font-awesome": "^4.0.0-rc.4", and the ember s failed with the trace containing:

Template Compiler Error (broccoli-persistent-filter:TemplateCompiler) in ember-font-awesome/components/fa-icon/template.hbs

loc$$1.sliceStartChars is not a function
skaverg commented 2 years ago

Any workarounds? Getting the same issue with ember-popper...

neilthawani commented 2 years ago

Getting this error in Ember 3.28.8.

mtnstar commented 2 years ago

error.dump.1894159c13b509344c3566a5fdd1b364.log

trying to upgrade from 3.24 to 3.28.8 and ran into the same error.

WIP on branch: https://github.com/puzzle/cryptopus/tree/ember-3.28-upgrade

any news on how to fix this?

I think ember-popper is creating this issue

viganella commented 2 years ago

Any update on this issue, as more of us start having it when upgrading to 3.28 ?

sunn2407 commented 2 years ago

Any workarounds? Getting the same issue with ember-popper...

@skaverg which version of ember popper are you using? For me, this error was from a package called 'ember-attacher' which used an older version of the ember popper, when updated the ember-attacher to 1.3.0 (which is the latest version), it worked for me (I was upgrading ember-cli from 3.20 to 3.28). It updated the ember-popper to 0.11.3. You may try this.

AL1077609 commented 1 year ago

Thanks everyone for the pointers. If it helps others:

We are working on upgrading ember little by little. Same as @sunn2407 : ember-cli 3.20.3 --> 3.28.6. We use ember-bootstrap heavily which was depending on a previous version of ember-popper (use npm list ember-popper to see where the dep is comming from). By moving ember-bootstrap to 4.9.0 (and forcing the bootstrapVersion to 3), I was able to bring ember-popper to v0.11.3 and eradicate the mentioned error.