Giter VIP home page Giter VIP logo

ember-cli-fastboot's Introduction

Ember FastBoot

npm version Actions Status

FastBoot allows you to render and serve Ember.js apps on the server. Using FastBoot, you can serve rendered HTML to browsers and other clients without requiring them to download JavaScript assets.

While FastBoot is has decent support in the Ember ecosystem these days, some application code, add-ons or other dependencies may need to be modified to work when being rendered serverside (e.g. you cannot call the window object during FastBoot).

Installation

FastBoot requires Ember 2.3 or higher. It is also preferable that your app is running ember-cli 2.12.0 and higher.

From within your Ember CLI application, run the following command:

ember install ember-cli-fastboot

Running

If your app is running ember-cli 2.12.0-beta.1+ you can run as follows:

  • ember serve
  • Visit your app at http://localhost:4200

You may be shocked to learn that minified code runs faster in Node than non-minified code, so you will probably want to run the production environment build for anything "serious."

ember serve --environment production

You can also specify the port (default is 4200):

ember serve --port 8088

See ember help for more.

Disabling FastBoot with ember serve

Optionally you can even disable the fastboot serving at runtime using the fastboot query parameter. Example to turn off fastboot serving, visit your app at http://localhost:4200/?fastboot=false. If you want to turn on fastboot serving again, simply visit at http://localhost:4200/?fastboot=true or http://localhost:4200/.

You can even disable serving fastboot with ember serve using an environment flag: FASTBOOT_DISABLED=true ember serve. If you have disabled building fastboot assets using the same flag as described here, remember to also disable serving fastboot assets when using ember serve.

FastBoot Configuration

When running locally using ember serve you can pass options into FastBoot instance via config/fastboot.js file. The configuration file is applicable only for applications, addons are not supported.

module.exports = function(environment) {
  let myGlobal = environment === 'production' ? process.env.MY_GLOBAL : 'testing';

  return {
    buildSandboxGlobals(defaultGlobals) {
      return Object.assign({}, defaultGlobals, {
        myGlobal,
      });
    }
  };
}

There are several options available, see FastBoot's README for more information, but be aware that distPath is provided internally by ember-cli-fastboot, hence it can not be modified by this file.

FastBoot App Server Configuration

When using FastBoot App Server for production environment you have to manually pass options from config/fastboot.js file.

const FastBootAppServer = require('fastboot-app-server');
const config = require('./config/fastboot')(process.env.NODE_ENV);

let server = new FastBootAppServer({
  distPath: 'dist',
  ...config,
});

server.start();

Using Node/npm Dependencies

Whitelisting Packages

When your app is running in FastBoot, it may need to use Node packages to replace features that are available only in the browser.

For security reasons, your Ember app running in FastBoot can only access packages that you have explicitly whitelisted.

To allow your app to require a package, add it to the fastbootDependencies array in your app's package.json:

{
  "name": "my-sweet-app",
  "version": "0.4.2",
  "devDependencies": {
    // ...
  },
  "dependencies": {
    // ...
  },
  "fastbootDependencies": [
    "rsvp",
    "path"
  ]
}

The fastbootDependencies in the above example means the only node modules your Ember app can use are rsvp and path.

If the package you are using is not built-in to Node, you must also specify the package and a version in the package.json dependencies hash. Built-in modules (path, fs, etc.) only need to be added to fastbootDependencies.

Using Dependencies

From your Ember.js app, you can run FastBoot.require() to require a package. This is identical to the CommonJS require except it checks all requests against the whitelist first.

let path = FastBoot.require('path');
let filePath = path.join('tmp', session.getID());

If you attempt to require a package that is not in the whitelist, FastBoot will raise an exception.

Note that the FastBoot global is only available when running in FastBoot mode. You should either guard against its presence or only use it in FastBoot-only initializers.

FastBoot Service

FastBoot registers the fastboot service. This service allows you to check if you are running within FastBoot by checking fastboot.isFastBoot. There is also a request object under fastboot.request which exposes details about the current request being handled by FastBoot

Delaying the server response

By default, FastBoot waits for the beforeModel, model, and afterModel hooks to resolve before sending the response back to the client. If you have asynchrony that runs outside of those contexts, your response may not reflect the state that you want.

To solve this, the fastboot service has deferRendering method that accepts a promise. It will chain all promises passed to it, and the FastBoot server will wait until all of these promises resolve before sending the response to the client. These promises must be chained before the rendering is complete after the model hooks. For example, if a component that is rendered into the page makes an async call for data, registering a promise to be resolved in its init hook would allow the component to defer the rendering of the page.

The following example demonstrates how the deferRendering method can be used to ensure posts data has been loaded asynchronously by a component before rendering the entire page. Note how the call should be wrapped in a fastboot.isFastBoot check since the method will throw an exception outside of that context:

import Component from '@glimmer/component';

export default class MyComponent extends Component {
  @service fastboot;
  @service model;

  constructor(owner, args) {
    super(owner, args);

    let promise = this.store.findAll('post').then((posts) => {
      this.posts = posts;
    });

    if (this.fastboot.isFastBoot) {
      this.fastboot.deferRendering(promise);
    }
  }
}

Cookies

You can access cookies for the current request via fastboot.request in the fastboot service.

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    let authToken = this.fastboot.request.cookies.auth;
    // ...
  }
}

The service's cookies property is an object containing the request's cookies as key/value pairs.

Headers

You can access the headers for the current request via fastboot.request in the fastboot service. The headers object implements part of the Fetch API's Headers class, the functions available are has, get, and getAll.

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    let headers = this.fastboot.request.headers;
    let xRequestHeader = headers.get('X-Request');
    // ...
  }
}

Host

You can access the host of the request that the current FastBoot server is responding to via fastboot.request in the fastboot service. The host property will return the host (example.com or localhost:3000).

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    let host = this.fastboot.request.host;
    // ...
  }
}

To retrieve the host of the current request, you must specify a list of hosts that you expect in your config/environment.js:

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'host',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      // ...
    },
    APP: {
      // ...
    },

    fastboot: {
      hostWhitelist: ['example.com', 'subdomain.example.com', /^localhost:\d+$/]
    }
  };
  // ...
};

The hostWhitelist can be a string or RegExp to match multiple hosts. Care should be taken when using a RegExp, as the host function relies on the Host HTTP header, which can be forged. You could potentially allow a malicious request if your RegExp is too permissive when using the host when making subsequent requests.

Retrieving host will error on 2 conditions:

  1. you do not have a hostWhitelist defined
  2. the Host header does not match an entry in your hostWhitelist

Query Parameters

You can access query parameters for the current request via fastboot.request in the fastboot service.

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    let authToken = this.fastboot.request.queryParams.auth;
    // ...
  }
}

The service's queryParams property is an object containing the request's query parameters as key/value pairs.

Path

You can access the path (/ or /some-path) of the request that the current FastBoot server is responding to via fastboot.request in the fastboot service.

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    let path = this.fastboot.request.path;
    // ...
  }
}

Protocol

You can access the protocol (http: or https:) of the request that the current FastBoot server is responding to via fastboot.request in the fastboot service.

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    let protocol = this.fastboot.request.protocol;
    // ...
  }
}

The Shoebox

You can pass application state from the FastBoot rendered application to the browser rendered application using a feature called the "Shoebox". This allows you to leverage server API calls made by the FastBoot rendered application on the browser rendered application. Thus preventing you from duplicating work that the FastBoot application is performing. This should result in a performance benefit for your browser application, as it does not need to issue server API calls whose results are available from the Shoebox.

The contents of the Shoebox are written to the HTML as strings within <script> tags by the server rendered application, which are then consumed by the browser rendered application.

This looks like:

<script type="fastboot/shoebox" id="shoebox-main-store">
{"data":[{"attributes":{"name":"AEC Professionals"},"id":106,"type":"audience"},
{"attributes":{"name":"Components"},"id":111,"type":"audience"},
{"attributes":{"name":"Emerging Professionals"},"id":116,"type":"audience"},
{"attributes":{"name":"Independent Voters"},"id":2801,"type":"audience"},
{"attributes":{"name":"Staff"},"id":141,"type":"audience"},
{"attributes":{"name":"Students"},"id":146,"type":"audience"}]}
</script>

You can add items into the shoebox with shoebox.put, and you can retrieve items from the shoebox using shoebox.retrieve. In the example below we use an object, shoeboxStore, that acts as our store of objects that reside in the shoebox. We can then add/remove items from the shoeboxStore in the FastBoot rendered application as we see fit. Then in the browser rendered application, it will grab the shoeboxStore from the shoebox and retrieve the record necessary for rendering this route.

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model(params) {
    let shoebox = this.fastboot.shoebox;
    let shoeboxStore = shoebox.retrieve('my-store');

    if (this.fastboot.isFastBoot) {
      return this.store.findRecord('post', params.post_id).then(post => {
        if (!shoeboxStore) {
          shoeboxStore = {};
          shoebox.put('my-store', shoeboxStore);
        }
        shoeboxStore[post.id] = post.toJSON();
      });
    } else {
      return shoeboxStore && shoeboxStore[params.post_id];
    }
  }
}

Think out of the Shoebox

Shoebox gives you great capabilities, but using it in the real app is pretty rough. Have you ever thought that such kind of logic should be done behind the scenes? In a large codebase, defining fastboot.isFastBoot conditionals can be a daunting task. Furthermore, it generates a lot of boilerplate code, which obscures the solution. Sooner or later coupling with shoebox will spread over all routes.

Solution: Application Adapter

One way to abstract the shoebox data storage mechanics is to move the logic into the Application Adapter as shown below.

export default class ApplicationAdapter extends JSONAPIAdapter.extend(
  // ...snip...

  cacheKeyFor([, model, id]) {
    return (model.modelName && id) ? `${model.modelName}-${id}` : 'default-store';
  }

  async findRecord() {
    const key = this.cacheKeyFor(arguments);

    if (this.fastboot.isFastBoot) {
      let result = await super.findRecord(...arguments);

      // must deep-copy for clean serialization.
      result = JSON.parse(JSON.stringify(result));

      this.fastboot.shoebox.put(key, result);

      return result;
    }

    let result = this.fastboot.shoebox.retrieve(key);

    if (!result) {
      result = await super.findRecord(...arguments);
    }

    // must deep-copy for clean serialization.
    return JSON.parse(JSON.stringify(result));
  }
}

With this strategy, any time an ember-data findRecord request happens while in Fastboot mode, the record will be put into the shoebox cache and returned. When subsequent calls are made for that record in the hydrated application, it will first check the shoebox data.

Solution: Use an Addon (ember-storefront)

Additionally, there is an addon called ember-data-storefront that can help to alleviate this pain, thanks to its Fastboot mixin: https://embermap.github.io/ember-data-storefront/docs/guides/fastboot.

After installing the addon and applying the mixin, your routes can look like this:

app/routes/my-route.js:

import Route from '@ember/routing/route';

export default class MyRoute extends Route {
  @service fastboot;

  model() {
    // first call in a server makes actual ajax request.
    // second call in a browser serves cached response
    return this.store.findAll('posts')
  }
}

And they still take advantage of caching in the shoebox. No more redundant AJAX for already acquired data. Installation details are available in the addon documentation.

Rehydration

What is Rehydration?

The rehydration feature means that the Glimmer VM can take a DOM tree created using Server Side Rendering (SSR) and use it as the starting point for the append pass.

See details here:

https://github.com/glimmerjs/glimmer-vm/commit/316805b9175e01698120b9566ec51c88d075026a

In order to utilize rehydration in Ember.js applications we need to ensure that both server side renderers (like fastboot) properly encode the DOM they send to the browser with the serialization format (introduced in the commit above) AND that the browser instantiated Ember.js application knows to use the rehydration builder to consume that DOM.

Rehydration is 100% opt-in, if you do not specify the environment flag your application will behave as it did before!

We can opt-in to the rehydration filter by setting the following environment flag:

EXPERIMENTAL_RENDER_MODE_SERIALIZE=true

This flag is read by Ember CLI Fastboot's dependency; fastboot to alert it to produce DOM with the glimmer-vm's serialization element builder. This addon (Ember CLI Fastboot) then uses a utility function from glimmer-vm that allows it to know whether or not the DOM it received in the browser side was generated by the serialization builder. If it was, it tells the Ember.js Application to use the rehydration builder and your application will be using rehydration.

Rehydration is only compatible with fastboot > 1.1.4-beta.1, and Ember.js > 3.2.

Build Hooks for FastBoot

Disabling incompatible dependencies

There are two places where the inclusion of incompatible JavaScript libraries could occur:

app.import in the application's ember-cli-build.js

If your Ember application is importing an incompatible Javascript library,you can use app.import with the using API.

app.import('vendor/fastboot-incompatible.js', {
  using: [
    {
      transformation: 'fastbootShim'
    }
  ]
});

app.import in an addon's included hook

You can include the incompatible Javascript libraries by wrapping them with a FastBoot variable check. In the browser, FastBoot global variable is not defined.

var map = require('broccoli-stew').map;

treeForVendor(defaultTree) {
  var browserVendorLib = new Funnel(...);

  browserVendorLib = map(browserVendorLib, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);

  return new mergeTrees([defaultTree, browserVendorLib]);
}

included() {
  // this file will be loaded in FastBoot but will not be eval'd
  app.import('vendor/<browserLibName>.js');
}

Note: ember-cli-fastboot will no longer provide the EMBER_CLI_FASTBOOT environment variable to differentiate browser and fastboot builds with rc builds and FastBoot 1.0 and above.

Loading additional assets in FastBoot environment

Often addons require to load libraries that are specific to the FastBoot environment and only need to be loaded on the server side. This can include loading libraries before or after the vendor file is loaded in the sandbox and/or before or after the app file is loaded in the sandbox. Since the FastBoot manifest defines an array of vendor and app files to load in the sandbox, an addon can define additional vendor/app files to load in the sandbox as well.

If your addon requires to load something in the sandbox: you can define the updateFastBootManifest hook from your addon (in index.js):

updateFastBootManifest(manifest) {
  /**
   * manifest is an object containing:
   * {
   *    vendorFiles: [<path of the vendor file to load>, ...],
   *    appFiles: [<path of the app file to load>, ...],
   *    htmlFile: '<path of the base page that should be served by FastBoot>'
   * }
   */

   // This will load the foo.js before vendor.js is loaded in sandbox
   manifest.vendorFiles.unshift('<path to foo.js under dist>');
   // This will load bar.js after app.js is loaded in the sandbox
   manifest.appFiles.push('<path to bar.js under dist>');

   // remember to return the updated manifest, otherwise your build will fail.
   return manifest;
}

Note: process.env.EMBER_CLI_FASTBOOT will be removed in RC builds and FastBoot 1.0. Therefore, if you are relying on this environment variable to import something in the fastboot environment, you should instead use updateFastBootManifest hook.

Conditionally include assets in FastBoot asset

Often your addon may need to conditionally include additional app trees based on ember version. Example, Ember changed an API and in order to have your addon be backward compatible for the API changes you want to include an asset when the ember version is x. For such usecases you could define the treeForFastBoot hook in your addon's index.js as below:

treeForFastBoot: function(tree) {
  let fastbootHtmlBarsTree;

  // check the ember version and conditionally patch the DOM api
  if (this._getEmberVersion().lt('2.10.0-alpha.1')) {
    fastbootHtmlBarsTree = this.treeGenerator(path.resolve(__dirname, 'fastboot-app-lt-2-9'));
    return tree ? new MergeTrees([tree, fastbootHtmlBarsTree]) : fastbootHtmlBarsTree;
  }

  return tree;
},

The tree is the additional fastboot asset that gets generated and contains the fastboot overrides.

Providing additional config

By default ember-cli-fastboot reads the app's config and provides it in the FastBoot sandbox as a JSON object. For the app in browser, it respects storeConfigInMeta and either reads it from the config meta tag or inlines it as JSON object in the app-name/config/environment AMD module.

Addons like ember-engines may split the app in different bundles that are loaded asynchronously. Since each bundle is loaded asynchronously, it can have its own configuration as well. In order to allow FastBoot to provide this config in the sandbox, it exposes a fastbootConfigTree build hook.

Addons wishing to use this hook simply need to return a unique identifier for the configuration with the configuration.

fastbootConfigTree() {
  return {
    '<engine-name>': {
      'foo': 'bar'
    }
  }
}

The above configuration will be available in Node via the FastBoot.config() function. Therefore, in order to get the above config, the addon/app can call FastBoot.config('<engine-name>').

Known Limitations

There are a few key restrictions developers should be aware of with FastBoot.

No didInsertElement

Since didInsertElement hooks are designed to let your component directly manipulate the DOM, and that doesn't make sense on the server where there is no DOM, we do not invoke either didInsertElement or willInsertElement hooks. The only component lifecycle hooks called in FastBoot are init, didReceiveAttrs, didUpdateAttrs, and willDestroy.

No jQuery

Running most of jQuery requires a full DOM. Most of jQuery will just not be supported when running in FastBoot mode. One exception is network code for fetching models, which we intended to support, but doesn't work at present.

Prototype extensions

Prototype extensions do not currently work across node "realms." Fastboot applications operate in two realms, a normal node environment and a virtual machine. Passing objects that originated from the normal realm will not contain the extension methods inside of the sandbox environment. For this reason, it's encouraged to disable prototype extensions.

Troubleshooting

Because your app is now running in Node.js, not the browser, you'll need a new set of tools to diagnose problems when things go wrong. Here are some tips and tricks we use for debugging our own apps.

Verbose Logging

Enable verbose logging by running the FastBoot server with the following environment variables set:

DEBUG=ember-cli-fastboot:* ember serve

PRs adding or improving logging facilities are very welcome.

Developer Tools

Thanks to recent improvements in NodeJS it is now possible to get a debugging environment that you can connect to with Chrome DevTools (version 55+). You can find more information on the new debugging method on Node's official documentation but here is a quick-start guide:

First let's start up the FastBoot server with Node in debug mode. One thing about debug mode: it makes everything much slower.

node --inspect-brk ./node_modules/.bin/ember serve

This starts the FastBoot server in debug mode. Note that the --inspect-brk flag will cause your app to start paused to give you a chance to open the debugger.

Once you see the output Debugger listening on ws://127.0.0.1:<port>/<guid>, open Chrome and visit chrome://inspect. Once it loads you should see an Ember target with a link "inspect" underneath. Click inspect and it should pop up a Chrome inspector window and you can click the โ–ถ๏ธŽ icon to let FastBoot continue loading.

Assuming your app loads without an exception, after a few seconds you will see a message that FastBoot is listening on port 3000. Once you see that, you can open a connection; any exceptions should be logged in the console, and you can use the tools you'd expect such as console.log, debugger statements, etc.

Note Regarding Node Versions

The above method only started working for the v8.x track of Node after version v8.4.0, which has a fix to this issue. If you are using any versions between v8.0 and v8.4 we would recommend upgrading to at least v8.4.0

For any versions prior to 6.4 the previous version of this documentation is still valid. Please follow those instructions here

Debugging via VS Code

Make sure you have .vscode/launch.json with minimal configuration that looks like below:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-node",
            "request": "launch",
            "name": "Debug Ember App",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "./node_modules/ember-cli/bin/ember",
            "args": "s"
        }
    ]
}

Tests

Run the automated tests by running npm test.

Note that the integration tests create new Ember applications via ember new and thus have to run an npm install, which can take several minutes, particularly on slow connections.

To speed up test runs you can run npm run test:precook to "precook" a node_modules directory that will be reused across test runs.

Debugging Integration Tests

Run the tests with the DEBUG environment variable set to fastboot-test to see verbose debugging output.

DEBUG=fastboot-test npm test

Questions

Reach out to us via Ember Community Discord in the #fastboot channel.

ember-cli-fastboot's People

Contributors

ankushdharkar avatar bekzod avatar bobisjan avatar chancancode avatar cibernox avatar danmcclain avatar dnalagatla avatar ef4 avatar greenkeeper[bot] avatar habdelra avatar hone avatar jasonmit avatar josemarluedke avatar kiwiupover avatar kratiahuja avatar locks avatar mansona avatar marcoow avatar mikrostew avatar pwfisher avatar rondale-sc avatar rwjblue avatar sergeastapov avatar simonihmig avatar snewcomer avatar stefanpenner avatar suchitadoshi1987 avatar tilde-engineering avatar tomdale avatar xg-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-fastboot's Issues

Component className binding to controller property breaks Fastboot server

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

TypeError: Object #<Object> has no method 'inject'

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)

Unable to load route models from store in Fastboot

Versions
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?

"ReferenceError: self is not defined" on "embr fastboot"

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?

Cannot read property 'userAgent' of undefined

$ 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?

DOMHelper issue

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)

Cannot read property 'forEach' of undefined

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

Exception: TypeError in ajax.js

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

Error when serving: "Cannot read property 'contextualElement' of null"

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.

Fails to run on Ubuntu with ember-cli 0.2.0

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.

backburner calls setTimeout() on server fetch

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.

Error: no global: `self` or `global` found

#45

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.

Wrong env in /tests while running `ember server`

Symptom:

  1. http://localhost:4200/tests is incorrectly in development mode while running ember server
  2. 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

indexOf of undefined while booting

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

Expose FastBoot service

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 Service

Inject it like any service:

import inject from "ember-service/inject";

export default Route.extend({
  fastboot: inject(),

  init() {
    let fastboot = this.get('fastboot');
  }
});

Environment Detection

export default Service.extend({
  fastboot: inject(),
  matchMedia(query) {
    if (this.get('fastboot.isFastBoot')) {
      return false;
    } else {
      return window.matchMedia(query).matches;
    }
  }
});

Cookies

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

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']);
  }
});

No option "--serve-assets"

$ 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)

Dockerized FastBoot Server

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.

Middleware hook?

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.

Tagless components cause fastboot to crash

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

ember 2.3.0 and ember-cli-fastboot raise `document is not defined` error

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?

Create Production App Server

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.

  • Specify interface (right now we bind to all interfaces/0.0.0.0)

The Road to 1.0

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.

Release Plan

  • Expose FastBoot service (#121)
    • Cookies
    • Headers
  • Support meta tags (Open Graph/Twitter cards)
  • Dockerized FastBoot server
  • Ability to manually disable addons in FastBoot build
  • Support query params
  • Respect outputPaths
  • Support multi-stage (browser โ†’ FastBoot) build with asset rewriting, so FastBoot index.html points at browser build, not FastBoot build
  • Documentation
    • Conceptual
    • Caveats/Known Limitations
    • How to Deploy
    • Production Debugging, Monitoring & Best Practices
    • List of compatible ember-cli-deploy plugins
    • Addon author guide
    • Upgrade guide for app authors
  • Fix issues with watch or revert feature for 1.0 release
  • Website Updates
    • Update references: ember-fastboot-server -> fastboot-app-server
    • Component hooks that get invoked
    • ember-cli-head
    • Document request and response properties on the FastBoot service
    • Document deferRendering API
    • Document the shoebox
  • Verify Node 0.12 compatibility
    • fastboot
    • fastboot-express-middleware
    • fastboot-app-server
    • ember-cli-fastboot
  • Cut 1.0 releases
    • fastboot
    • fastboot-express-middleware
    • fastboot-app-server
    • ember-cli-fastboot

Nice to Have

Please chime in with anything I've missed.

Fastboot does not run with Babel browser polyfill

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.

Error on startup: no global: `self` or `global` found

$ 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?

Support Meta Tags (OpenGraph / Twitter Cards)

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.

Memory leak in fastboot server mode

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.

Fastboot issues

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.

Add FastBoot to ember-try

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

Missing module `chalk`

$ 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.

Disable Incompatible Dependencies

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.

Ember FastBoot running at http://:::3000

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

HTTP status codes for routes

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 handler
  • 404 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 guess

AJAX request from fastboot do not have correct headers

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

Enable route pre-rendering / cacheing via fastboot mechanisms.

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.

Brand new ember-cli app results in "Could not read config from meta tag with name"

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

Will not start -- jQuery is not defined or Module did not self-register

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)

document is not defined

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?

Build Error

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

Generate Request ID

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.