Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using timezone in environment.js crashes fastboot #55

Closed
jurecuhalev opened this issue Aug 2, 2016 · 8 comments
Closed

Using timezone in environment.js crashes fastboot #55

jurecuhalev opened this issue Aug 2, 2016 · 8 comments
Assignees

Comments

@jurecuhalev
Copy link

jurecuhalev commented Aug 2, 2016

Apologies if it's against wrong repo. I'm not yet sure how to distinguish between fastboot and addon errors.

Steps to reproduce:

  1. Add:
    moment: {
      includeTimezone: '2010-2020'
    }

to environment.js:

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'moment-fastboot-example',
    environment: environment,
    rootURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    },
    moment: {
      includeTimezone: '2010-2020'
    }
  };
..
  1. Run NODE_DEBUG=fs ember fastboot --serve-assets
➜  moment-fastboot-example git:(master) ✗ NODE_DEBUG=fs ember fastboot --serve-assets
Installing FastBoot npm dependencies

Build successful - 5007ms.

Slowest Trees                                 | Total               
----------------------------------------------+---------------------
Addon#treeFor (ember-cli-release - addon)     | 499ms               
Funnel: Addon JS                              | 451ms               
SourceMapConcat: Concat: Vendor /assets/ve... | 275ms               
SourceMapConcat: Concat: Vendor /assets/ve... | 272ms               

Slowest Trees (cumulative)                    | Total (avg)         
----------------------------------------------+---------------------
Babel (30)                                    | 1060ms (35 ms)      
Funnel: Addon JS (18)                         | 555ms (30 ms)       
SourceMapConcat: Concat: Vendor /asset... (2) | 548ms (274 ms)      
Addon#treeFor (ember-cli-release - addon) (2) | 500ms (250 ms)      

fs.js:88
        throw backtrace;
        ^

Error: ENOTEMPTY: directory not empty, rmdir '/Users/gandalf/hacking/fastboot/moment-fastboot-example/dist/node_modules/moment-timezone/'
    at rethrow (fs.js:83:21)
    at maybeCallback (fs.js:101:42)
    at Object.fs.rmdir (fs.js:871:14)
    at TreeSync.<anonymous> (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/tree-sync/index.js:79:19)
    at Array.forEach (native)
    at TreeSync.sync (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/tree-sync/index.js:50:14)
    at CoreObject.module.exports.Task.extend.copyToOutputPath (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/ember-cli/lib/models/builder.js:173:10)
    at /Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/ember-cli/lib/models/builder.js:187:21
    at lib$rsvp$$internal$$tryCatch (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/rsvp/dist/rsvp.js:505:17)

This error persists even if I remove the above lines in the environment.js

Repo with the above problem: https://github.com/gandalfar/moment-fastboot-example

➜  moment-fastboot-example git:(master) ember -v
ember-cli: 2.7.0
node: 6.2.1
os: darwin x64
@jasonmit
Copy link
Owner

jasonmit commented Aug 3, 2016

Thanks for the example app, I'll need a few days to dig into it.

/cc @rlivsey who had done some work to implement fastboot support who may have encountered this

@jasonmit jasonmit self-assigned this Aug 3, 2016
@jasonmit
Copy link
Owner

jasonmit commented Aug 3, 2016

@gandalfar I pulled the repository down and I'm not able to reproduce this.

The only difference being I'm on linux, everything else is the same.

image

@jasonmit
Copy link
Owner

jasonmit commented Aug 3, 2016

Update: The first time I try and build ember-cli-fastboot fails with:

There was an error trying to run your application in FastBoot.

This is usually caused by either your application code or an addon trying to access an API that isn't available in Node.js.
Based on the stack trace, it looks like the exception was generated in util.js on line 1008.
The exception is probably coming from your app. Look at this file and line number to determine what is triggering the exception.

The full stack trace is:

spawn /bin/sh ENOENT
Error: spawn /bin/sh ENOENT
    at exports._errnoException (util.js:1008:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
    at onErrorNT (internal/child_process.js:348:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

This looks to be happening when fastboot tries to npm install. Since it's failing there for me, it's likely why I'm not seeing the error you are pointing out. This error looks unrelated to ember-moment/ember-cli-moment-shim but I'll need to figure out how to resolve that before tackling this issue.

@jasonmit
Copy link
Owner

jasonmit commented Aug 3, 2016

Update 2: looks like the above issue is a race condition between fastboot and when the dist folder is created.

I was not able to see your issue after that. Can you try backing down to ember-cli-fastboot@1.0.0-beta.4 to see if you can reproduce it there?

@jurecuhalev
Copy link
Author

Trying it now

@jurecuhalev
Copy link
Author

jurecuhalev commented Aug 3, 2016

It looks like this might be unrelated to ember-moment. I've had the includeTimezone commented out by accident and it still crashed with ember-cli-fastboot@1.0.0-beta.4

The first time I run it, it runs correctly. The second time, (just ^C between), it crashes with:

^C%
 ➜  moment-fastboot-example git:(master) ✗ NODE_DEBUG=fs ember fastboot --serve-assets
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
DEPRECATION: EmberApp.concatFiles() is deprecated. Please use the `broccoli-concat` module directly.
Built project successfully. Stored in "dist".
Installing FastBoot npm dependencies
fs.js:88
        throw backtrace;
        ^

Error: ENOTEMPTY: directory not empty, rmdir '/Users/gandalf/hacking/fastboot/moment-fastboot-example/dist/node_modules/moment/src/'
    at rethrow (fs.js:83:21)
    at maybeCallback (fs.js:101:42)
    at Object.fs.rmdir (fs.js:871:14)
    at TreeSync.<anonymous> (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/tree-sync/index.js:79:19)
    at Array.forEach (native)
    at TreeSync.sync (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/tree-sync/index.js:50:14)
    at CoreObject.module.exports.Task.extend.copyToOutputPath (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/ember-cli/lib/models/builder.js:173:10)
    at /Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/ember-cli/lib/models/builder.js:187:21
    at lib$rsvp$$internal$$tryCatch (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/gandalf/hacking/fastboot/moment-fastboot-example/node_modules/rsvp/dist/rsvp.js:505:17)

@jasonmit
Copy link
Owner

jasonmit commented Aug 3, 2016

Yeah, I believe this to be a symptom of the same race condition I pointed out above. There are string of issues that seem to be stemming around the same thing, the npm install either nooping because the package.json was rewritten to /dist and it noops. Or, you can get into the state above, but it all seems to stem from around the exec('npm install') in the ember-cli-fastboot tasks\fastboot-server

Can you open a new issue against ember-cli-fastboot? I'll dig deeper tomorrow.

@jurecuhalev
Copy link
Author

jurecuhalev commented Aug 3, 2016

Ok, I did now nombom and rerun it with "ember-cli-fastboot": "1.0.0-beta.8" and the problem is still there, it seems that I mistakenly connected with the timezone variable.

Thanks for quick feedback. I'll open a new issue and reference this for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants