ember-ajax icon indicating copy to clipboard operation
ember-ajax copied to clipboard

Support Fastboot

Open topaxi opened this issue 8 years ago • 5 comments

Note from @alexlafroscia: Basic support has been added in #75, but I want to keep this issue open until we can add Fastboot testing to our automated testing setup. Until then, things should work but we can't be sure, please make a separate issue with any problems you run into!

Note from @alexlafroscia (10/12/2016): There is actually ways to test Fastboot now, so we have the tools to add that and close this issue:

  • [x] Add tests that verify ember-ajax works in Fastboot
  • [ ] Add test for header parsing (#162)

An addon to help with running the tests in Fastboot can be found here. Example usage can be found here.

Versions:

  • node 5.7.0
  • ember-cli 2.4.2
  • ember-ajax 0.7.1 or 2.0.0-beta.2 (or the current master branch)

Steps to reproduce:

$ ember new fastboot-test
$ ember install ember-cli-fastboot
$ ember install [email protected]

Inject and get the ajax service somewhere. The following error gets printed to the console once the browser enters a route with the ajax service in use: (NOTE: The error triggers as soon as I try call .get('ajax') to get the service.)

$ ember fastboot --serve-assets
version: 2.4.2
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
Built project successfully. Stored in "fastboot-dist".
Installing FastBoot npm dependencies
DEBUG: -------------------------------
DEBUG: Ember : 2.4.1
DEBUG: -------------------------------
Ember FastBoot running at http://[::]:3000
Error: Could not find module `url` imported from `(require)`
    at missingModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:164:1)
    at findModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:179:1)
    at requireModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:168:1)
    at Module.callback (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/ember-ajax/utils/url-helpers.js:30:1)
    at Module.exports (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:83:1)
    at Module.build (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:133:1)
    at findModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:181:1)
    at Module.reify (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:115:1)
    at Module.build (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:133:1)
    at findModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:181:1)
    at Module.reify (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:115:1)
    at Module.build (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:133:1)
    at findModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:181:1)
    at Module.reify (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:115:1)
    at Module.build (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:133:1)
    at findModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:181:1)
    at requireModule (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/vendor/loader/loader.js:168:1)
    at [object Object]._extractDefaultExport (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/ember-resolver/resolver.js:346:1)
    at [object Object].resolveOther (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/ember-resolver/resolver.js:81:1)
    at [object Object].superWrapper (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:23203:1)
    at [object Object].exports.default._emberRuntimeSystemObject.default.extend.resolve (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:5828:1)
    at resolve (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:2385:1)
    at Object.Registry.resolve (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1898:1)
    at Object.Registry.resolve (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1902:1)
    at has (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:2402:1)
    at Object.Registry.has (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1988:1)
    at Object.Registry.validateInjections (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:2290:1)
    at instantiate (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1474:1)
    at lookup (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1330:1)
    at Object.Container.lookup (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1257:1)
    at [object Object].lookup (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:33427:1)
    at /home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:28240:1
    at Object.exports.default._routerUtils.subclass.applyToState (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:52641:1)
    at Object.getTransitionByIntent (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:51642:1)
    at Object.Router.transitionByIntent (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:51754:1)
    at doTransition (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:52326:1)
    at Object.Router.handleURL (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:51796:1)
    at [object Object]._emberRuntimeSystemObject.default.extend._doURLTransition (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:28010:1)
    at [object Object]._emberRuntimeSystemObject.default.extend.handleURL (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:28006:1)
    at [object Object].ApplicationInstance.reopen.visit (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:3997:1)
    at tryCatch (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:53542:1)
    at invokeCallback (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:53557:1)
    at publish (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:53525:1)
    at /home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:32081:1
    at Queue.invoke (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:333:1)
    at Object.Queue.flush (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:397:1)
    at Object.DeferredActionQueues.flush (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:205:1)
    at Object.Backburner.end (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:560:1)
    at [object Object]._onTimeout (/home/dsenn/gitty/github/topaxi.ch/fastboot-dist/assets/bower_components/ember/ember.debug.js:1126:1)
2016-03-08T17:08:35.358Z 500 Unknown Error: Error: Could not find module `url` imported from `(require)` 277ms

I tried to fix this by adding

"fastbootDependencies": [ "url" ]

to my package.json without success.

topaxi avatar Mar 08 '16 17:03 topaxi

Thanks for reporting. This might take some time to address, but supporting Fastboot is important to us and is definitely something we'll be working on in the very near future.

alexlafroscia avatar Mar 08 '16 22:03 alexlafroscia

Is there a timeline for this? This is currently blocking me from trying out fastboot, so it would be really cool to have this functionality :)

mydea avatar May 23 '16 23:05 mydea

@mydea what isn't working for you? Basic Fastboot support should be included; ember-ajax will pull in the najax module when it detects the Fastboot environment.

alexlafroscia avatar May 28 '16 07:05 alexlafroscia

Oh, I haven't tried it for a while - I was assuming it is still not working because this issue was still open. I'll try it soon, but great if it works now! :+1:

mydea avatar May 29 '16 16:05 mydea

Yeah, I suppose this should have been closed by #75. We claim "basic", almost "experimental" support at this point because we have no way to actually run the automated testing against the Fastboot environment to ensure that things work exactly the way they should. I'm hesitant to claim official support at this point without having tests run against Fastboot as part of our CI.

Edit: I added a note to the issue itself to link to that PR and explain the current Fastboot situation.

alexlafroscia avatar May 29 '16 20:05 alexlafroscia