ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
852 stars 160 forks source link

htmlSafe function not available in @ember/string but only in fastboot #855

Closed mansona closed 1 year ago

mansona commented 2 years ago

When running in fastboot we get an error TypeError: (0 , _string.htmlSafe) is not a function but running the same app in the browser doesn't have the same issue.

I have noticed this issue with the Ember Blog https://github.com/ember-learn/ember-blog and when debugging I can confirm that the object that is injected in place of @ember/string does indeed not have the htmlSafe function.

In Fastboot:

Screenshot 2021-08-29 at 07 12 28

The exact same code in the browser:

Screenshot 2021-08-29 at 07 14 04

Something else that is odd with this error is that it is a "caught error". For me to hit it in the debugger I had to select "Pause on caught exceptions". It also doesn't register as an error when doing a Prember run which means that we have not been Fasbooting the Ember blog for a while now and we just didn't notice 🙈

I know this is a known deprecation and with Ember 4.0 it is pretty urgent to fix as quickly as possible but I'm surprised that this is broken in fastboot and working in the browser 🤔

hoIIer commented 2 years ago

@mansona did you ever figure this out? I'm seeing same thing after updating deps

st-h commented 1 year ago

I have experienced something similar, however in my case it was merely triggering a deprecation. And I was only seeing it in the browser, but not on the fastboot server. While trying to find a solution, someone suggested this issue: https://github.com/emberjs/ember-string/issues/235#issuecomment-1061413761

essentially there are competing implementations in ember-source and @ember/string and it looks like nobody knows when which one will be used and under what circumstances.

possibly this issue will also fix that https://github.com/emberjs/ember.js/issues/20383

kategengler commented 1 year ago

v5.0 of ember-source removes the internal implementation of @ember/string, so yes, it should be fixed then.

v3.0.1 of @ember/string added htmlSafe method that errors and explains what needs to change. I suspect this can be closed.

mansona commented 1 year ago

Yes I think this can be closed too 👍