ember-cli-fastboot icon indicating copy to clipboard operation
ember-cli-fastboot copied to clipboard

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

Open mansona opened this issue 4 years ago • 1 comments

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 🤔

mansona avatar Aug 29 '21 06:08 mansona

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

erichaus avatar Feb 07 '22 00:02 erichaus

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

st-h avatar Feb 26 '23 12:02 st-h

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.

kategengler avatar Mar 24 '23 19:03 kategengler

Yes I think this can be closed too 👍

mansona avatar Apr 06 '23 09:04 mansona