Search code examples
javascriptember.jsember-cli

Ember FastBoot Cannot read property 'userAgent' of undefined


I'm trying to use Ember FastBoot for my application but when I run: ember fastboot --serve-assets this error is thrown:

Cannot read property 'userAgent' of undefined TypeError: Cannot read property 'userAgent' of undefined at Object.125.global/document (<anonymous>:121923:53) at s (<anonymous>:104896:621) at <anonymous>:104896:672 at Object.106../big-play-button.js (<anonymous>:113849:23) at s (<anonymous>:104896:621) at <anonymous>:104896:672 at Object.139.../../src/js/utils/merge-options.js (<anonymous>:123824:15) at s (<anonymous>:104896:621) at e (<anonymous>:104896:792) at <anonymous>:104896:810

any help?


Solution

  • The repo you posted contains a number of references to document and window. You will have to use the ember provided facility for detecting the current environment details and implement conditional logic based on whether your pages are being rendered in the browser or not. You can use environment.hasDOM to perform that check.