ember-fastboot / ember-cli-fastboot Goto Github PK
View Code? Open in Web Editor NEWServer-side rendering for Ember.js apps
Home Page: http://ember-fastboot.com/
License: MIT License
Server-side rendering for Ember.js apps
Home Page: http://ember-fastboot.com/
License: MIT License
when trying to launch ember fastboot I've got:
DEBUG=ember-cli-fastboot:* ember fastboot --serve-assets
version: 2.2.0-beta.6
Built project successfully. Stored in "fastboot-dist".
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
ember-cli-fastboot:ember-app app created; app=fastboot-dist/assets/chirper.js; vendor=fastboot-dist/assets/vendor.js +0ms
WARNING: FEATURE["ember-application-visit"] is set as enabled, but FEATURE flags are only available in canary builds.
document is not defined
ReferenceError: document is not defined
at <anonymous>:110604:16969
and here is my env:
ember-cli: 2.2.0-beta.6
ember: 2.3.0
ember-cli-fastboot: 0.1.0
ember-data: 2.3.1
node: 5.4.0
--- update 18/01/16 13:40 ---
I've updated to 059c0ad (master), by ember install https://github.com/tildeio/ember-cli-fastboot.git
unfortunately still the same issue.
DEBUG=ember-cli-fastboot:* ember fastboot --serve-assets
version: 2.2.0-beta.6
Built project successfully. Stored in "fastboot-dist".
ember-cli-fastboot:ember-app app created; app=fastboot-dist/assets/chirper.js; vendor=fastboot-dist/assets/vendor.js +0ms
document is not defined
ReferenceError: document is not defined
at <anonymous>:110604:16969
--- update 18/01/16 13:40 ---
I've no idea where / how should I start debugging it?
Right now there's no way for an Ember application to put content into the <meta>
tag of a page. This is necessary for FastBoot, especially for OpenGraph and Twitter cards. This will likely require an extension to Ember itself, although maybe we can do something as a quick workaround until a full solution is in place.
ร la Rails, show how long each request took to service in Rails
Symptom:
http://localhost:4200/tests
is incorrectly in development
mode while running ember server
http://localhost:4200/tests
is correctly in test
mode while running ember test --server
If ember-cli-fastboot
is removed from package.json
, the erroneous behavior disappear.
$ ember -v
version: 2.2.0-beta.1
node: 0.12.1
npm: 2.14.10
os: darwin x64
When hitting the server with an url with query params this line drops the search part of the url and it is never picked up because the Location is forced to 'none' here in Ember
Somewhat related to: #89
Our API follows the JSONAPI spec, and requires the application/vnd.json+api
content-type/accepts header. Even though it is specified via JSONAPIAdapter, the "ajax" requests coming from fastboot lack that header
When I run fastboot, it seems to run without a host, (http://:::3000 rather than http://127.0.0.1:3000). Would that issue be with my local environment, or with fastboot? Or is that not an issue at all?
DEBUG: -------------------------------
DEBUG: Ember : 1.12.1
DEBUG: Ember Data : 1.0.0-beta.20+canary.60c01a3f30
DEBUG: -------------------------------
Ember FastBoot running at http://:::3000
$ ember fastboot --serve-assets
version: 0.2.7
The option '--serve-assets' is not registered with the fastboot command. Run `ember fastboot --help` for a list of supported options.
The help does not output the option as well
$ ember help fastboot
version: 0.2.7
Requested ember-cli commands:
ember fastboot <options...>
Runs a server to render your app using FastBoot.
--build (Boolean) (Default: true)
--environment (String) (Default: development)
aliases: -e <value>, -dev (--environment=development), -prod (--environment=production)
--port (Number) (Default: 3000)
Not sure if this is the place to report bugs but just tired out ember-cli-fasboot
and not seem to be getting it to work.
When I install the latest 0.0.2
I get the following error:
version: 0.2.0-beta.1
Built project successfully. Stored in "dist".
DEBUG: -------------------------------
DEBUG: Ember : 1.12.0-beta.1+canary.f5873415
DEBUG: Ember Data : 1.0.0-beta.15
DEBUG: -------------------------------
Ember FastBoot running at http://:::3000
undefined:0
/* jshint ignore:start */
TypeError: Cannot read property 'entries' of undefined
at <anonymous>:58848:38
at Array.exports.default.mixin.Mixin.create.find (<anonymous>:38120:30)
at Ember.DefaultResolver.extend.findModuleName (<anonymous>:58847:44)
at resolveOther (<anonymous>:58712:37)
at superWrapper (<anonymous>:26855:20)
at exports.default.EmberObject.default.extend.resolveView (<anonymous>:14407:19)
at exports.default.EmberObject.default.extend.resolve (<anonymous>:14267:43)
at Object.resolve [as resolver] (<anonymous>:14033:23)
at resolve (<anonymous>:11558:29)
at Object.Registry.resolve (<anonymous>:11102:21)
After installing straight from master, all works fine and I get Ember FastBoot running at http://:::3000
but when I go to http://localhost:3000/
it just times out and nothing logs.
This is a very barebone app just with a an application and index template using the pod structure, running on the latest iojs
, ember
, ember-cli
, etc.
Hi there! I have a problem:
ember fastboot --serve-assets
version: 1.13.8
Built project successfully. Stored in "fastboot-dist".
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
document is not defined
ReferenceError: document is not defined
at <anonymous>:139924:54
at <anonymous>:136465:9
at <anonymous>:136467:2
Can you help me?
This is a quest issue tracking the features and bug fixes needed to consider FastBoot ready for mass consumption. Expect this list to grow over time. All discussion and details should be broken out into separate issues/PRs; this issue is just for coordinating and tracking work.
outputPaths
watch
or revert feature for 1.0 releaserequest
and response
properties on the FastBoot servicedeferRendering
APIfastboot
fastboot-express-middleware
fastboot-app-server
ember-cli-fastboot
fastboot
fastboot-express-middleware
fastboot-app-server
ember-cli-fastboot
Please chime in with anything I've missed.
najax
should be directly accessible for apps that want to use basic ajax requests, and then decorated for ember-data specific usage.
Given that multiple application instances can be running in parallel, each producing log output, we should generate a unique ID per application instance, and use that unique ID to identify all log output.
We should probably also make the ID available inside the app, as developers may want to use it. Though, now that I think about it, we may want to have a generic request
service that contains metadata about the incoming request. Eventually we will want to support things like cookie auth, so that may be a good place for things like cookie info, requester IP, request ID, etc.
Not quite sure what this means.
$ DEBUG=ember-cli-fastboot:* ember fastboot
version: 0.2.3
Built project successfully. Stored in "dist".
ember-cli-fastboot:ember-app app created; app=dist/assets/empart.js; vendor=dist/assets/vendor.js +0ms
ember-cli-fastboot:ember-app vendor file evaluated +165ms
DEBUG: -------------------------------
DEBUG: Ember : 1.13.0-beta.1+canary.d10d66e8
DEBUG: Ember Data : 1.0.0-beta.17+canary.51bac6a48b
DEBUG: -------------------------------
ember-cli-fastboot:ember-app app file evaluated +13ms
Ember FastBoot running at http://:::3000
undefined:124
var domHelper = new Ember.View.DOMHelper(doc);
^
TypeError: undefined is not a function
at Object.initialize (<anonymous>:124:25)
at <anonymous>:14744:23
at <anonymous>:14767:9
at visit (<anonymous>:12712:7)
at DAG.topsort (<anonymous>:12824:11)
at Namespace.default.extend._runInitializer (<anonymous>:14766:13)
at Namespace.default.extend.runInitializers (<anonymous>:14740:12)
at Namespace.default.extend.boot (<anonymous>:14656:12)
at Namespace.default.extend.domReady (<anonymous>:14640:12)
at Queue.invoke (<anonymous>:11430:18)
Trying to run fastboot (master) with the babel-browser-polyfill crashes with:
TypeError: Cannot read property 'prototype' of undefined
at Object.58../$ (<anonymous>:2132:25)
at s (<anonymous>:13:255)
at <anonymous>:13:306
at Object.93../modules/$ (<anonymous>:3269:1)
at s (<anonymous>:13:255)
at <anonymous>:13:306
at Object.<anonymous> (<anonymous>:21:1)
at Object.1../tools/protect.js (<anonymous>:33:4)
at s (<anonymous>:13:255)
at e (<anonymous>:13:426)
My ember-cli-build.js looks roughly like this:
var EmberApp = require('ember-cli/lib/broccoli/ember-app')
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
babel: {
optional: [ 'es7.asyncFunctions' ]
}
})
app.import('vendor/babel-polyfill.js', { prepend: true })
return app.toTree()
}
I'm not experienced enough with fastboot and contextify to debug this.
When I start Fastboot I'm getting this nondescript error. Is this an issue with Canary?
$ ember fastboot
version: 0.2.3
Built project successfully. Stored in "dist".
self is not defined
ReferenceError: self is not defined
at <anonymous>:60862:35
at <anonymous>:72394:4
$ ember fastboot
version: 0.2.0-beta.1
Built project successfully. Stored in "dist".
Cannot find module 'chalk'
Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/brandon/code/myapp/node_modules/ember-cli-fastboot/lib/models/server.js:2:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Nothing in there except a completely bare ember app, I followed the directions as per the README.
Fastboot currently assumes your EmberApp
uses the stock outputPaths for its assets.
https://github.com/tildeio/ember-cli-fastboot/blob/master/lib/commands/fastboot.js#L81-L91
$ DEBUG=ember-cli-fastboot:* ember fastboot
version: 0.2.7
Building..
Built project successfully. Stored in "dist".
ember-cli-fastboot:ember-app app created; app=dist/assets/try-fastboot.js; vendor=dist/assets/vendor.js +0ms
no global: `self` or `global` found
Error: no global: `self` or `global` found
at <anonymous>:11344:11
at internalRequire (<anonymous>:10627:16)
at internalRequire (<anonymous>:10623:24)
at internalRequire (<anonymous>:10623:24)
at internalRequire (<anonymous>:10623:24)
at internalRequire (<anonymous>:10623:24)
at internalRequire (<anonymous>:10623:24)
at internalRequire (<anonymous>:10623:24)
at requireModule (<anonymous>:10593:14)
at <anonymous>:67295:1
What do I do wrong?
Seems like this should be a 404 :)
Shortly after boot with the lastest build:
undefined: 74
registry.injection('adapter', 'ajax', 'ajax:node');
^
TypeError: undefined is not a function
This is in app/initializers/ajax.js
One of our goals for FastBoot is to make it really easy to install and deploy.
To that end, I'd love it if someone adapted the Elastic Beanstalk FastBoot server for Docker. I have to confess I've never used Docker before, so while I'm happy to do it, it would be much faster for someone who does have some experience to tackle it.
Steps - (NB: I'm installing my fork but only to get the project to build and generate html)
ember new testlinkto
cd testlinkto
bower install components/ember#canary components/ember-data#canary --save
npm install express
npm install glob
npm install ember-fastboot-server
ember install artistechmedia/ember-cli-fastboot.git#master
ember fastboot:build
At this point if you want to use a server script like this one that prints out the memory/heap allocation.
node --expose-gc server
And then hit it with a few 100 curl statements you'll note that the heap stays pretty stable with no growth after the a gc.
BUT if you add some #link-to components to app/templates/application.hbs
{{#link-to index}}homepage{{/link-to}}
{{#link-to index}}homepage{{/link-to}}
then you'll see that heap gives up about 2MB per link-to which is devastating if you have nav-bars/menus with a few dozen links.
Right now, serving an Ember app via FastBoot requires running ember fastboot
from within an Ember CLI app. This means you have to install Ember CLI and its many, many dependencies to a production server.
Instead, we should create a slimmed down server that doesn't have an Ember CLI dependency but just the bare minimum to load and run the compiled Ember file and serve HTTP requests. The FastBoot Ember CLI addon can then just require that server as a dependency and start it up when you run ember fastboot
.
After following the installation instructions, running $ ember fastboot
, and going to http://localhost:3000, I get the following CLI error:
DEBUG: -------------------------------
DEBUG: Ember : 1.12.0-beta.1+canary.f3c73c7a
DEBUG: Ember Data : 1.0.0-beta.12
DEBUG: -------------------------------
Ember FastBoot running at http://0.0.0.0:3000
Handling /
TypeError: Cannot read property 'contextualElement' of null
at View.default.extend.render (<anonymous>:52519:69)
at EmberRenderer_createElement [as createElement] (<anonymous>:51292:14)
at EmberRenderer.Renderer_renderTree [as renderTree] (<anonymous>:21896:22)
at CoreView.default.extend.createElement (<anonymous>:55785:21)
at Object.Backburner.run (<anonymous>:13762:27)
at Object.run (<anonymous>:29415:27)
at <anonymous>:87:33
at tryCatch (<anonymous>:60130:16)
at invokeCallback (<anonymous>:60142:17)
at publish (<anonymous>:60113:11)
Unfortunately it prevents localhost from ever loading.
When deploying fastboot to staging environment (on Heroku), I've encounter problem that heroku expects you to bind port to 0.0.0.0 (IPv4). I've introduced another option to command line in order to get there.
Many addons don't load in FastBoot, often for reasons that are accidental and easy to fix. It would be awesome if ember-try
could add a mode to test addons in FastBoot, so addon authors can detect and fix these issues.
/cc @kategengler
I recently updated to ember-cli 0.2.0
When I run ember fastboot --environment production
I am recieving the following error:
self is not defined
ReferenceError: self is not defined
at :59311:35
at :70728:4
line 59311 contains:
var ember$lib$main$$default = self.Ember;
I am running a Ubuntu droplet, 12.04 x32
I tried various version of node (0.12.1, 0.12.0, 0.10.33) with the same result.
I am recieving the same error running ember fastboot
Update: I reverted back to an older ember-cli and still getting this error. Now I am suspecting something else. I will keep hunting, will close this issue if I find something else the culprit. Also, ember serve
is working it's just ember fastboot
that's having a problem.
Update 2:I think the problem is with the current canary builds. I am still investigating.
Since Glimmer landed in canary, didInsertElement
hooks now appear to be invoked when visiting a url.
When including the current master version (8ab0b33) of fastboot like this
// package.json
{
...
"devDependencies": {
"ember-cli-fastboot": "tildeio/ember-cli-fastboot.git#master",
...
}
}
And then just run npm intall
and ember fastboot
, I get this error
version: 0.2.7
Built project successfully. Stored in "fastboot-dist".
Cannot read property 'indexOf' of undefined
TypeError: Cannot read property 'indexOf' of undefined
at <anonymous>:19:3258
at <anonymous>:21:15567
Using ember#canary
I'm digging into this now, but the gist is, if you use a component that does not have its own tag (tagName: ''
), fastboot will crash because the EventDispatch ends up in the container and blows up when destroy
is called on it. EventDispatch.destroy
calls jQuery.off
Hi,
I create a new ember-cli app today and added the ember-cli-fastboot addon.
I'm running against ember canary as of today (#678e59e1cd), however when I try to run 'ember fastboot' I get the error below.
Any help would be greatly appreciated.
$ ember fastboot --serve-assets
version: 0.2.6
The option '--serve-assets' is not registered with the fastboot command. Run `ember fastboot --help` for a list of supported options.
Built project successfully. Stored in "dist".
Could not read config from meta tag with name "try/config/environment".
Error: Could not read config from meta tag with name "try/config/environment".
My index.html is the default generated one.
Thanks,
Ian
Here's what I get when I try to run ember fastboot
. To the best of my knowledge, everything is installed correctly, but apparently not.
elp2:example_project user$ ember fastboot
version: 0.2.2
Built project successfully. Stored in "dist".
self is not defined
ReferenceError: self is not defined
at <anonymous>:63785:35
at <anonymous>:75317:4
This is in a completely clean project that was created using ember new
.
Any ideas?
I've hit many use cases on mobile where optimized routes will still have rendering times > 100ms. Sometimes these routes, such as index route, are heavily trafficked by a single user, being entered and left often.
I've tried various non-ember centric methods of pre-rendering and cacheing views and their html, but these approaches' reliance on private APIs inevitably leaves them heavily susceptible to internal api churn.
It would be a huge benefit for apps that need to highly optimize rendering if the fastboot work resulted in additional hooks for connecting and disconnecting rendered html to any view, but especially the primary view/component for a route.
Something such as .on('viewWillDisconnect')
which could receive the current state and DOM for a view and .on('viewWillConnect')
which could be provided a state and a DOM that's either been cached previously or pre-rendered via an ajax call to the server running fastboot. The ultimate goal being that rendering could be optimally balanced between client and server as needed.
It's possible this is already part of the plan for Fastboot, but I haven't seen this particular use case of feature set discussed. If it is part of the plan, I'd love to read more about it.
I'm trying Fastboot for my e-commerce app:
https://github.com/vectart/e-commerce-concept/tree/fastboot-bug
When the app is loaded in Fastboot-mode and I open http://localhost:3000/, the following error happens:
undefined:52562
return sel ? jQuery['default'](sel, elem) : jQuery['default'](elem);
^
TypeError: Property 'default' of object #<Object> is not a function
at Object.merge.default.$ (<anonymous>:52562:68)
at CoreView.default.extend.$ (<anonymous>:53748:32)
at null.<anonymous> (<anonymous>:47733:23)
at Object.merge.default.invokeObserver (<anonymous>:52613:16)
at stateCheckedFn (<anonymous>:54191:27)
at Queue.invoke (<anonymous>:13359:18)
at Object.Queue.flush (<anonymous>:13424:13)
at Object.DeferredActionQueues.flush (<anonymous>:13229:19)
at Object.Backburner.end (<anonymous>:12654:27)
at Object.Backburner.run (<anonymous>:12709:20)
I've figured out that it caused by isActive:active
className binding at https://github.com/vectart/e-commerce-concept/blob/fastboot-bug/app/components/product-details.js#L9.
This causes calling anonymous function at https://github.com/emberjs/ember.js/blob/5fd2d035b30aa9ebfe73de824b3b283ec8e589cc/packages/ember-views/lib/mixins/class_names_support.js#L123 and eventually fails in $
method https://github.com/emberjs/ember.js/blob/5fd2d035b30aa9ebfe73de824b3b283ec8e589cc/packages/ember-views/lib/views/states/has_element.js#L20
Added in #27. Needs to be added to README.
I trying to run fastboot but get error:
DEBUG: -------------------------------
DEBUG: Ember : 1.13.2
DEBUG: Ember Data : 1.0.0-beta.16.1
DEBUG: -------------------------------
[ ] -view-registry:main ........................................ chat/main/-view-registry
[ ] -view-registry:main ........................................ undefined
[ ] -view-registry:main ........................................ chat/-view-registry
[ ] -view-registry:main ........................................ chat/-view-registrys/main
[ ] -view-registry:main ........................................ undefined
[ ] -view-registry:main ........................................ chat/main/-view-registry
[ ] -view-registry:main ........................................ undefined
[ ] -view-registry:main ........................................ chat/-view-registry
[ ] -view-registry:main ........................................ chat/-view-registrys/main
[ ] -view-registry:main ........................................ undefined
Ember FastBoot running at http://0.0.0.0:8089
undefined:1500
application.inject('adapter', 'ajax', 'ajax:node');
^
TypeError: Object # has no method 'inject'
at Object.exports.default.initialize (:1500:21)
at :17882:23
at :17909:9
at visit (:15794:5)
at DAG.topsort (:15905:9)
at _emberRuntimeSystemNamespace.default.extend._runInitializer (:17908:13)
at _emberRuntimeSystemNamespace.default.extend.runInitializers (:17878:12)
at _emberRuntimeSystemNamespace.default.extend.boot (:17795:12)
at _emberRuntimeSystemNamespace.default.extend.domReady (:17781:12)
at Queue.invoke (:14456:16)
I assume the same for ajaxSuccess
, but here is the line in question: https://github.com/tildeio/ember-cli-fastboot/blob/master/app/initializers/server/ajax.js#L14
When the API returns an error, fastboot dies
Are you intending on providing a middleware hook similar to this? Our app has some processing and additions to the page that need to happen before the page is served.
version: 0.2.7
no global: `self` or `global` found
Error: no global: `self` or `global` found
at <anonymous>:11348:11
at internalRequire (<anonymous>:10631:16)
at internalRequire (<anonymous>:10627:24)
at internalRequire (<anonymous>:10627:24)
at internalRequire (<anonymous>:10627:24)
at internalRequire (<anonymous>:10627:24)
at internalRequire (<anonymous>:10627:24)
at internalRequire (<anonymous>:10627:24)
at requireModule (<anonymous>:10597:14)
at <anonymous>:67551:1
Bower config set to use Ember and Ember Data canary.
The module throwing the error is backburner/platform
.
Hi!
I'm trying to get ember fastboot up and running and I can't manage to get ember cli to even boot. Here's the repo https://github.com/scottmessinger/ember-fastboot-demo and here are the errors I'm seeing:
With Node 0.10.32
Future versions of Ember CLI will not support v0.10.32. Please update to Node 0.12 or io.js.
version: 1.13.8
Built project successfully. Stored in "fastboot-dist".
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
jQuery is not defined
ReferenceError: jQuery is not defined
at <anonymous>:64348:41
at <anonymous>:64349:3
at Object.Contextify.sandbox.run (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/node_modules/contextify/lib/contextify.js:12:24)
at new EmberApp (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/lib/models/ember-app.js:29:11)
at new FastBootServer (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/lib/models/server.js:7:14)
at Class.module.exports.runCommand (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/lib/commands/fastboot.js:21:18)
at Class.<anonymous> (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/lib/commands/fastboot.js:72:19)
at lib$rsvp$$internal$$tryCatch (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:493:16)
at lib$rsvp$$internal$$invokeCallback (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:505:17)
at lib$rsvp$$internal$$publish (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:476:11)
With iojs*
teachnow:mervo scottmessinger$ nvm use iojs
Now using io.js v2.4.0 (npm v2.13.0)
teachnow:mervo scottmessinger$ ember fastboot
version: 1.13.8
Built project successfully. Stored in "fastboot-dist".
Module did not self-register.
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/node_modules/contextify/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/node_modules/contextify/lib/contextify.js:1:96)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
With Node 0.12.7
teachnow:mervo scottmessinger$ nvm use 0.12
Now using node v0.12.7 (npm v2.11.3)
teachnow:mervo scottmessinger$ ember fastboot
version: 1.13.8
Built project successfully. Stored in "fastboot-dist".
Module did not self-register.
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/node_modules/contextify/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/Users/scottmessinger/code/commoncurriculum/mervo/node_modules/ember-cli-fastboot/node_modules/contextify/lib/contextify.js:1:96)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
We need some way to tell Ember CLI not to include addons that rely on document
/other DOM features in the build output for FastBoot, since they cause the app to raise an exception on boot.
I wanted to jot down some thoughts about how we expose FastBoot functionality and additional data into Ember apps. The idea is pretty simple: expose a fastboot
service that can house whatever APIs we need to expose to app and addon developers over time.
fastboot
ServiceInject it like any service:
import inject from "ember-service/inject";
export default Route.extend({
fastboot: inject(),
init() {
let fastboot = this.get('fastboot');
}
});
export default Service.extend({
fastboot: inject(),
matchMedia(query) {
if (this.get('fastboot.isFastBoot')) {
return false;
} else {
return window.matchMedia(query).matches;
}
}
});
Cookies sent by the requester's browser.
export default Service.extend({
fastboot: inject(),
isAuthorized() {
let cookies = this.get('fastboot.cookies');
return this.verifyAuthToken(cookies.authToken);
}
});
Headers attached to the HTTP request for this route.
export default Service.extend({
fastboot: inject(),
isAuthorized() {
let headers = this.get('fastboot.headers');
return this.verifyAuthToken(headers['X-Auth-Token']);
}
});
$ 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
ideas?
I created a brand new ember app and added ember-cli-fastboot as per the instructions in the README. When I ran ember fastboot --serve-assets I got:
Cannot read property 'forEach' of undefined
TypeError: Cannot read property 'forEach' of undefined
at <anonymous>:66453:71
at <anonymous>:83282:4
A Ember route should be able to somehow set a HTTP status code with fastboot.
I see mostly four cases:
404
for a this.route('notfound', { path: '/*path' })
catch-all 404 handler404
for a error route which fails because something was not found (ember-data, ajax, etc.)403
authentication errors on routes (for example through ember-simple-auth)500
any non-handled error route/action, I guessVersions
Ember: 2.2.0-canary+c0c72266
Ember-Data: 2.2.0-canary
Only when running with fastboot, calling this.store.find('model', 123)
in any route's model hook, results in the following assertion:
'Assertion Failed: You made a request for a undefined with id 1, but the adapter\'s response did not have any data'
We also found the need to implement ajaxSuccess
and ajaxError
on our RESTAdapter (also tried JSONApiAdapter to confirm). I thought those were depreciated which I feel confident in, because they are not called in browser runs of the same route.
In the end, we do see the ajax payload being returned to the adapter, but it's not available when the findRecord
promise is resolved here.
Is this related to the ajax implementation in Fastboot?
It doesn't always happen but on certain cases where there's lots of ajax and queued activity backburner will call (window.)setTimeout() causing the app to crash and not return a page. My workaround was to detect the server and stub out the call which is a shaky solution (works for me) but hardly ideal.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.