Comments (5)
UPDATE
I've tried using ember-cli-fastboot
same error:
$ ember fastboot --serve-assets
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
59:vidler andreistalbe$
from fastboot.
UPDATE 2
OK, the error was cause by video.js
component, the plugin is using document
and window
to extract different types of data from the browser, userAgent
in this case, however, fastboot
being server-side doesn't know about these instances. Is there a way to safely build these dependencies? Some of the components are totally intended for client side environment so they should be skipped somehow. Is there a way to make it work on the current version of ember-fastboot-server
?
from fastboot.
Some of the components are totally intended for client side environment so they should be skipped somehow
You would need to guard against the navigator being available before accessing it since it doesn't look like the sandbox environment shims it.
https://github.com/ember-fastboot/ember-fastboot-server/blob/master/lib/ember-app.js#L71-L82
from fastboot.
@jasonmit I can't think of a general solution that would solve this problem in particular and all others that may occur with other custom ember components. Ensuring window.navigator
exists before it's tried to be accessed requires me to change this 3rd party library which leads to more errors down the road because the userAgent
is used on bootstrap the component. Setting window.navigator.userAgent
to a default value might do the trick rather than ensuring it exists.
As a possible solution, can this be shimmed in the createSandbox()
?
from fastboot.
Closing this for now; let's make sure we cover things like this in the upgrade guide.
from fastboot.
Related Issues (20)
- Deprecate resilient mode HOT 11
- Disabling Fastboot during deploy HOT 1
- Changing the FastBoot runtime environment HOT 3
- FastBoot.require is broken when running locally HOT 7
- Ember array methods HOT 2
- [SOLVED] ReferenceError: crypto is not defined (octane) HOT 3
- Refactor `sandboxGlobals` options into `buildSandboxGlobals`
- Refactor `destroyAppInstanceInMs` system
- Move Application and ApplicationInstance creation into VM sandbox
- Drop `najax` global by default? HOT 5
- Block elements inside `p` cause rehydration failures HOT 2
- Drop `FastBoot.require` for 3rd dependencies? HOT 5
- An in-range update of resolve is breaking the build 🚨 HOT 5
- Fastboot 3.0.0 error
- An in-range update of eslint-plugin-node is breaking the build 🚨 HOT 1
- Update Shoebox Documentation
- Cannot wait for promises after model hooks HOT 4
- Quickstart is not working HOT 3
- /snapshots directory is included and balloons the package size HOT 2
- ChainAlert: npm package release (3.2.0) has no matching tag in this repo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastboot.